commit af498cdd3737f03a77ada5172fff1f727f463b10
parent 8022f78f34e2b0532f880d2d64d363bb1e20531d
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sat, 18 Jul 2015 10:53:02 +0200
Fix constant calculation in node()
Non constant nodes make descendat non constant
independent of the other node, so we need &
and not |.
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/cc1/code.c b/cc1/code.c
@@ -321,14 +321,15 @@ node(unsigned op, Type *tp, Node *lp, Node *rp)
np->op = op;
np->type = tp;
np->sym = NULL;
- np->constant = np->symbol = np->lvalue = 0;
+ np->symbol = np->lvalue = 0;
+ np->constant = 1;
np->left = lp;
np->right = rp;
if (lp)
- np->constant |= lp->constant;
+ np->constant &= lp->constant;
if (rp)
- np->constant |= rp->constant;
+ np->constant &= rp->constant;
return np;
}