summaryrefslogtreecommitdiff
path: root/util/romcc
diff options
context:
space:
mode:
authorPatrick Georgi <patrick.georgi@coresystems.de>2010-03-15 10:32:59 +0000
committerPatrick Georgi <patrick.georgi@coresystems.de>2010-03-15 10:32:59 +0000
commit8f4546f7cacd4dfecd2b318e6810dce1f57e45db (patch)
tree40c8e6727168297f95c1398e7e713df9bae687a7 /util/romcc
parent3b8d6a866deaa7b21ee25ce78eedd99118d7663a (diff)
downloadcoreboot-8f4546f7cacd4dfecd2b318e6810dce1f57e45db.tar.xz
Use copy_triple only on non-flattened nodes.
Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5212 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/romcc')
-rw-r--r--util/romcc/romcc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/util/romcc/romcc.c b/util/romcc/romcc.c
index 5fa7ede182..b6f68409be 100644
--- a/util/romcc/romcc.c
+++ b/util/romcc/romcc.c
@@ -11557,7 +11557,7 @@ static struct triple *constant_expr(struct compile_state *state)
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 @@ static struct triple *assignment_expr(struct compile_state *state)
*/
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 @@ static struct triple *assignment_expr(struct compile_state *state)
}
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 @@ static struct triple *assignment_expr(struct compile_state *state)
}
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;