Handle disp parameter correctly

This commit is contained in:
gingerBill
2026-08-12 09:34:16 +01:00
parent a9df33e482
commit 612b25a425
2 changed files with 6 additions and 4 deletions

View File

@@ -977,7 +977,9 @@ gb_internal void check_asm_instruction_operand(AsmCtx *asm_ctx, CheckerContext *
default:
{
gbString s = expr_to_string(index.expr);
error(index.expr, "An index must be an integer register, got %s", s);
gbString t = type_to_string(index.type);
error(index.expr, "An index must be an integer register, got %s of type %s", s, t);
gb_string_free(t);
gb_string_free(s);
ok_kind = false;
}

View File

@@ -2459,12 +2459,12 @@ gb_internal Ast *parse_asm_operand(AstFile *f, bool allow_memory_operand) {
scale_op = f->prev_token;
index = possible_index;
scale = parse_asm_operand(f, false);
if (allow_token(f, Token_Add)) {
disp = parse_asm_operand(f, false);
}
} else {
index = possible_index;
}
if (allow_token(f, Token_Add)) {
disp = parse_asm_operand(f, false);
}
}
Token close = expect_token(f, Token_CloseBracket);