Author: oxygene
Date: Mon Mar 15 11:32:59 2010
New Revision: 5212
URL: https://tracker.coreboot.org/trac/coreboot/changeset/5212

Log:
Use copy_triple only on non-flattened nodes.

Signed-off-by: Patrick Georgi <[email protected]>
Acked-by: Stefan Reinauer <[email protected]>

Modified:
   trunk/util/romcc/romcc.c

Modified: trunk/util/romcc/romcc.c
==============================================================================
--- trunk/util/romcc/romcc.c    Mon Mar 15 11:04:06 2010        (r5211)
+++ trunk/util/romcc/romcc.c    Mon Mar 15 11:32:59 2010        (r5212)
@@ -11557,7 +11557,7 @@
 
 static struct triple *assignment_expr(struct compile_state *state)
 {
-       struct triple *def, *left, *right;
+       struct triple *def, *left, *left2, *right;
        int tok, op, sign;
        /* The C grammer in K&R shows assignment expressions
         * only taking unary expressions as input on their
@@ -11578,6 +11578,9 @@
         */
        def = conditional_expr(state);
        left = def;
+       left2 = left;
+       if (!(left2->id & TRIPLE_FLAG_FLATTENED))
+               left2 = copy_triple(state, left2);
        switch((tok = peek(state))) {
        case TOK_EQ:
                lvalue(state, left);
@@ -11603,19 +11606,19 @@
                }
                def = write_expr(state, left,
                        triple(state, op, left->type, 
-                               read_expr(state, copy_triple(state, left)), 
right));
+                               read_expr(state, left2), right));
                break;
        case TOK_PLUSEQ:
                lvalue(state, left);
                eat(state, TOK_PLUSEQ);
                def = write_expr(state, left,
-                       mk_add_expr(state, copy_triple(state, left), 
assignment_expr(state)));
+                       mk_add_expr(state, left2, assignment_expr(state)));
                break;
        case TOK_MINUSEQ:
                lvalue(state, left);
                eat(state, TOK_MINUSEQ);
                def = write_expr(state, left,
-                       mk_sub_expr(state, copy_triple(state, left), 
assignment_expr(state)));
+                       mk_sub_expr(state, left2, assignment_expr(state)));
                break;
        case TOK_SLEQ:
        case TOK_SREQ:
@@ -11639,7 +11642,7 @@
                }
                def = write_expr(state, left,
                        triple(state, op, left->type, 
-                               read_expr(state, copy_triple(state,left)), 
right));
+                               read_expr(state, left2), right));
                break;
        }
        return def;

-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to