From 0ed628b22f1a7920dc004117ad803680e3c70cbd Mon Sep 17 00:00:00 2001 From: kalsprite Date: Tue, 11 Aug 2026 17:46:31 -0700 Subject: [PATCH] fix byte swap on untyped intlike types --- src/check_builtin.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp index 4910dafb0..d52e2a896 100644 --- a/src/check_builtin.cpp +++ b/src/check_builtin.cpp @@ -5770,6 +5770,14 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As error(x.expr, "Invalid type passed to '%.*s', got %s", LIT(builtin_name), xts); gb_string_free(xts); } + // An untyped constant is integer-like, so it reaches the size check below, and + // `type_size_of` asserts on a type that has no size. + // no-op on typed types + convert_to_typed(c, &x, default_type(x.type)); + if (x.mode == Addressing_Invalid) { + return false; + } + i64 sz = type_size_of(x.type); if (sz < 2) { gbString xts = type_to_string(x.type);