commit af498cdd3737f03a77ada5172fff1f727f463b10
Author:     Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Sat Jul 18 10:53:02 2015 +0200
Commit:     Roberto E. Vargas Caballero <[email protected]>
CommitDate: Sat Jul 18 10:53:02 2015 +0200

    Fix constant calculation in node()
    
    Non constant nodes make descendat non constant
    independent of the other node, so we need &
    and not |.

diff --git a/cc1/code.c b/cc1/code.c
index 1d28b62..e5ee575 100644
--- 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;
 }

Reply via email to