Use flow_analyze_statement to get statement operands.

Getting the operands directly from the statement was missing the
destination operand of movep when movep's op_c was a constant pointer and
thus the flowvar wasn't being counted/created early enough. This led to a
segfault in the set code when attempting to add -1 to the set.
This commit is contained in:
Bill Currie 2012-12-20 19:02:55 +09:00
parent 5ec4598fce
commit 4d587eaa25

View file

@ -319,8 +319,9 @@ static void
flow_build_vars (function_t *func)
{
statement_t *s;
operand_t *operands[4];
int num_vars = 0;
int i;
int i, j;
set_t *stuse;
set_t *stdef;
set_iter_t *var_i;
@ -335,9 +336,9 @@ flow_build_vars (function_t *func)
// variables
for (i = 0; i < func->num_statements; i++) {
s = func->statements[i];
num_vars += count_operand (s->opa);
num_vars += count_operand (s->opb);
num_vars += count_operand (s->opc);
flow_analyze_statement (s, 0, 0, 0, operands);
for (j = 0; j < 4; j++)
num_vars += count_operand (operands[j]);
}
if (!num_vars)
return;
@ -355,9 +356,9 @@ flow_build_vars (function_t *func)
// variables
for (i = 0; i < func->num_statements; i++) {
s = func->statements[i];
add_operand (func, s->opa);
add_operand (func, s->opb);
add_operand (func, s->opc);
flow_analyze_statement (s, 0, 0, 0, operands);
for (j = 0; j < 4; j++)
add_operand (func, operands[j]);
flow_analyze_statement (s, stuse, stdef, 0, 0);
for (var_i = set_first (stdef); var_i; var_i = set_next (var_i)) {