scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 38670978b7243e0b2093c553a4c3df03178d9d0a
parent 4462308d95e9aede0ea42f4262bb082007beb427
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri,  5 Nov 2021 21:47:29 +0100

cc1: Remove wrong optimization in content()

Collapsing OADDR and OPTR is a really bad idea, because
it removes the indirection operation needed.

Diffstat:
Msrc/cmd/cc/cc1/expr.c | 9+--------
1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/src/cmd/cc/cc1/expr.c b/src/cmd/cc/cc1/expr.c @@ -470,14 +470,7 @@ content(int op, Node *np) if (BTYPE(np) != PTR) { errorp("invalid argument of memory indirection"); } else { - if (np->op == OADDR) { - Node *new = np->left; - new->type = np->type->type; - free(np); - np = new; - } else { - np = node(op, np->type->type, np, NULL); - } + np = node(op, np->type->type, np, NULL); np->flags |= NLVAL; } return np;