From d08816cb6b4cc7838e95caa583f938af018bbb5e Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 7 Dec 2024 00:22:53 +0900 Subject: [PATCH] [qfcc] Update offset for aliased defs When getting an offset alias of an already aliased def, the offset needs to be updated so it points to the correct part of the def. This is actually a rather old bug but it got uncovered somehow with my rework of the ruamoko semantic processing (probably an altered cast). --- tools/qfcc/source/statements.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/qfcc/source/statements.c b/tools/qfcc/source/statements.c index 057ac4dec..e2adb62dc 100644 --- a/tools/qfcc/source/statements.c +++ b/tools/qfcc/source/statements.c @@ -516,8 +516,10 @@ offset_alias_operand (const type_t *type, int offset, operand_t *aop, return top; } else if (aop->op_type == op_def) { def = aop->def; - while (def->alias) + while (def->alias) { + offset += def->offset; def = def->alias; + } return def_operand (alias_def (def, type, offset), 0, expr); } else if (aop->op_type == op_value) { if (!is_ptr (aop->value->type)) {