Rewrite expr_alias().

Modifying the existing alias chain proved to be a bad idea (in retrospect,
I should have known better:P). Instead, just walk down any existing alias
chain to the root operand and build a new alias from that.
This commit is contained in:
Bill Currie 2012-11-26 21:30:57 +09:00
parent 215ff61216
commit 31b07bcbbf

View file

@ -748,15 +748,13 @@ expr_expr (sblock_t *sblock, expr_t *e, operand_t **op)
static sblock_t *
expr_alias (sblock_t *sblock, expr_t *e, operand_t **op)
{
operand_t *aop = 0;
sblock = statement_subexpr (sblock, e->e.expr.e1, &aop);
while (aop->op_type == op_alias)
aop = aop->o.alias;
*op = new_operand (op_alias);
(*op)->type = low_level_type (e->e.expr.type);
sblock = statement_subexpr (sblock, e->e.expr.e1, &(*op)->o.alias);
while ((*op)->o.alias->op_type == op_alias) {
operand_t *top = (*op)->o.alias;
(*op)->o.alias = (*op)->o.alias->o.alias;
top->op_type = op_symbol; // so free_operand won't follow the alias
free_operand (top);
}
(*op)->o.alias = aop;
return sblock;
}