commit 2fdc51bcc25975c04b6f40f51f87712e5a1a60d8
parent 67327320b7553450ecf3eb824b3dbec3d7dea096
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sat, 1 Jul 2017 18:09:18 +0200
[cc1] Rewrite null()
Null() cannot simplify because it returns a boolean value,
and it means that the parent of the current node hasn't a
way to verify thet its child i sthe same after calling null().
This new version of the patch matches the tree for (void *) 0.Z
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/cc1/expr.c b/cc1/expr.c
@@ -120,10 +120,13 @@ set_p1_p2:
static int
null(Node *np)
{
- if (np->op == OCAST)
- np = simplify(np);
- if (!(np->flags&NCONST) || np->type != pvoidtype)
+ if (np->type != pvoidtype || np->op != OCAST)
return 0;
+
+ np = np->left;
+ if (np->type != inttype)
+ return 0;
+
return cmpnode(np, 0);
}