scc

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

commit b4c69c62f6a2bb1bf283215c223a1466e9806dd7
parent c32f54c6312385220fa2e721370647cf0b67607d
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;