From e8c38e74274b57a5de71d983ce9231bb7d27458e Mon Sep 17 00:00:00 2001 From: gingerBill Date: Thu, 20 Feb 2025 17:50:56 +0000 Subject: Handle `any` correctly for 32-bit systems --- src/llvm_backend_utility.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/llvm_backend_utility.cpp') diff --git a/src/llvm_backend_utility.cpp b/src/llvm_backend_utility.cpp index aa425a9d5..0ba95bb1e 100644 --- a/src/llvm_backend_utility.cpp +++ b/src/llvm_backend_utility.cpp @@ -971,6 +971,13 @@ gb_internal i32 lb_convert_struct_index(lbModule *m, Type *t, i32 index) { if (t->kind == Type_Struct) { auto field_remapping = lb_get_struct_remapping(m, t); return field_remapping[index]; + } else if (is_type_any(t) && build_context.ptr_size == 4) { + GB_ASSERT(t->kind == Type_Basic); + GB_ASSERT(t->Basic.kind == Basic_any); + switch (index) { + case 0: return 0; // data + case 1: return 2; // id + } } else if (build_context.ptr_size != build_context.int_size) { switch (t->kind) { case Type_Basic: -- cgit v1.2.3