shithub: scc

Download patch

ref: a30b9999606a95dfdc73c4ae0264c2fecdb992c0
parent: 025b7f7df0d8cd7577556a0a3e5d389c54996511
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sat Jul 1 14:09:18 EDT 2017

[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

--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -120,10 +120,13 @@
 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);
 }