Fix segfault of romcc when complex assignment operators
were applied to non-trivial LHSs, eg. c[4] |= 1; 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@5210 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
cc66926955
commit
f761aef932
|
@ -1896,12 +1896,16 @@ static void use_triple(struct triple *used, struct triple *user)
|
||||||
return;
|
return;
|
||||||
if (!user)
|
if (!user)
|
||||||
return;
|
return;
|
||||||
ptr = &used->use;
|
if (used->use == (void*)-1)
|
||||||
while(*ptr) {
|
used->use = 0;
|
||||||
if ((*ptr)->member == user) {
|
if (used->use) {
|
||||||
return;
|
ptr = &used->use;
|
||||||
|
while(*ptr) {
|
||||||
|
if ((*ptr)->member == user) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ptr = &(*ptr)->next;
|
||||||
}
|
}
|
||||||
ptr = &(*ptr)->next;
|
|
||||||
}
|
}
|
||||||
/* Append new to the head of the list,
|
/* Append new to the head of the list,
|
||||||
* copy_func and rename_block_variables
|
* copy_func and rename_block_variables
|
||||||
|
@ -11599,19 +11603,19 @@ static struct triple *assignment_expr(struct compile_state *state)
|
||||||
}
|
}
|
||||||
def = write_expr(state, left,
|
def = write_expr(state, left,
|
||||||
triple(state, op, left->type,
|
triple(state, op, left->type,
|
||||||
read_expr(state, left), right));
|
read_expr(state, copy_triple(state, left)), right));
|
||||||
break;
|
break;
|
||||||
case TOK_PLUSEQ:
|
case TOK_PLUSEQ:
|
||||||
lvalue(state, left);
|
lvalue(state, left);
|
||||||
eat(state, TOK_PLUSEQ);
|
eat(state, TOK_PLUSEQ);
|
||||||
def = write_expr(state, left,
|
def = write_expr(state, left,
|
||||||
mk_add_expr(state, left, assignment_expr(state)));
|
mk_add_expr(state, copy_triple(state, left), assignment_expr(state)));
|
||||||
break;
|
break;
|
||||||
case TOK_MINUSEQ:
|
case TOK_MINUSEQ:
|
||||||
lvalue(state, left);
|
lvalue(state, left);
|
||||||
eat(state, TOK_MINUSEQ);
|
eat(state, TOK_MINUSEQ);
|
||||||
def = write_expr(state, left,
|
def = write_expr(state, left,
|
||||||
mk_sub_expr(state, left, assignment_expr(state)));
|
mk_sub_expr(state, copy_triple(state, left), assignment_expr(state)));
|
||||||
break;
|
break;
|
||||||
case TOK_SLEQ:
|
case TOK_SLEQ:
|
||||||
case TOK_SREQ:
|
case TOK_SREQ:
|
||||||
|
@ -11635,7 +11639,7 @@ static struct triple *assignment_expr(struct compile_state *state)
|
||||||
}
|
}
|
||||||
def = write_expr(state, left,
|
def = write_expr(state, left,
|
||||||
triple(state, op, left->type,
|
triple(state, op, left->type,
|
||||||
read_expr(state, left), right));
|
read_expr(state, copy_triple(state,left)), right));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return def;
|
return def;
|
||||||
|
|
Loading…
Reference in New Issue