diff --git a/tools/qfcc/source/dags.c b/tools/qfcc/source/dags.c index eef594c1a..19b5764d4 100644 --- a/tools/qfcc/source/dags.c +++ b/tools/qfcc/source/dags.c @@ -1348,10 +1348,17 @@ dag_gencode (dag_t *dag, sblock_t *block, dagnode_t *dagnode) internal_error (dagnode->label->expr, "invalid alias node"); } auto value = dagnode->children[0]->value; + int offset = 0; if (op_is_alias (value)) { + //FIXME? this check shouldn't be necessary, but aliased defs + //stay as aliased defs in the dag. I'm not sure this is the + //right fix, or even in the right direction + if (value->op_type == op_def) { + offset = op_alias_offset (value); + } value = unalias_op (value); } - dst = offset_alias_operand (dagnode->types[0], dagnode->offset, + dst = offset_alias_operand (dagnode->types[0], dagnode->offset + offset, value, dagnode->label->expr); if ((var_iter = set_first (dagnode->identifiers))) { type = dst->type; diff --git a/tools/qfcc/source/expr_compound.c b/tools/qfcc/source/expr_compound.c index a3da1027f..21bf2136b 100644 --- a/tools/qfcc/source/expr_compound.c +++ b/tools/qfcc/source/expr_compound.c @@ -251,7 +251,7 @@ build_element_chain (element_chain_t *element_chain, const type_t *type, if (ele->expr && ele->expr->type == ex_compound) { build_element_chain (element_chain, state.type, ele->expr, - state.offset); + base_offset + state.offset); } else { element_t *element = new_element (0, 0); element->type = state.type;