From 612b25a425950fb54214dd2bdf31f24aa78804d4 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Wed, 12 Aug 2026 09:34:16 +0100 Subject: [PATCH] Handle `disp` parameter correctly --- src/check_asm.cpp | 4 +++- src/parser.cpp | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/check_asm.cpp b/src/check_asm.cpp index cbaeab8c5..089afb05a 100644 --- a/src/check_asm.cpp +++ b/src/check_asm.cpp @@ -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; } diff --git a/src/parser.cpp b/src/parser.cpp index a67aafe35..8b81334a1 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -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);