Fix the source of alias def chains.

The actual bug might still be elsewhere, but at least now I know the alias
chains were coming from accessing .return and .param_N, which are unions
(not directly usable by the progs engine). Emitting a reference to a union
(or struct) would create an alias def, but an alias expression was created
in the expression tree to simplify return/param access. The double layer
(sometimes 3 or 4) alias isn't really neaded, so rather than layering the
aliases, just re-alias the alaised def.
This commit is contained in:
Bill Currie 2012-05-03 13:28:16 +09:00
parent ec98e3e206
commit 006882407d

View file

@ -119,8 +119,10 @@ get_operand_def (expr_t *expr, operand_t *op)
}
return def;
case op_alias:
def = alias_def (get_operand_def (expr, op->o.alias),
ev_types[op->type]);
def = get_operand_def (expr, op->o.alias);
if (def->alias)
def = def->alias;
def = alias_def (def, ev_types[op->type]);
return def;
}
return 0;
@ -141,8 +143,6 @@ add_statement_def_ref (def_t *def, dstatement_t *st, int field)
alias_depth_expr.line = def->line;
}
alias_depth++;
//FIXME it seems there is a bug somewhere creating chains
//of aliases
def_t *a = def;
offset_reloc |= def->offset_reloc;
def = def->alias;