scc

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

commit 4875fa42070d04d0ad2688d76ae96eb6d5cb0224
parent f72c50b215daa8a5262439c0e070d5ce012041de
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun, 11 Jun 2017 09:51:21 +0200

[cc1] Simplify before testing in null()

This function was designed when folding was done at the same time that
the tree was built, but this is not true anymore, and it was generating
that (void *) 0 wasn't a constant expression which could be compared
with 0 to determine that it was a null expression.

Diffstat:
Mcc1/expr.c | 2++
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/cc1/expr.c b/cc1/expr.c @@ -120,6 +120,8 @@ set_p1_p2: static int null(Node *np) { + if (np->op == OCAST) + np = simplify(np); if (!(np->flags&NCONST) || np->type != pvoidtype) return 0; return cmpnode(np, 0);