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
1 changed files with 5 additions and 7 deletions

View File

@ -748,15 +748,13 @@ expr_expr (sblock_t *sblock, expr_t *e, operand_t **op)
static sblock_t * static sblock_t *
expr_alias (sblock_t *sblock, expr_t *e, operand_t **op) 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 = new_operand (op_alias);
(*op)->type = low_level_type (e->e.expr.type); (*op)->type = low_level_type (e->e.expr.type);
sblock = statement_subexpr (sblock, e->e.expr.e1, &(*op)->o.alias); (*op)->o.alias = aop;
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);
}
return sblock; return sblock;
} }