From 46ed5500b1ff56cbd0ad8544f4d053e6ab7f579c Mon Sep 17 00:00:00 2001 From: gingerBill Date: Wed, 22 Apr 2026 13:18:26 +0100 Subject: [PATCH] Fix `lb_convert_struct_index` for `struct #raw_union` --- src/llvm_backend_utility.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/llvm_backend_utility.cpp b/src/llvm_backend_utility.cpp index 3905adfcd..a04f91fbd 100644 --- a/src/llvm_backend_utility.cpp +++ b/src/llvm_backend_utility.cpp @@ -1069,6 +1069,9 @@ gb_internal lbStructFieldRemapping lb_get_struct_remapping(lbModule *m, Type *t) gb_internal i32 lb_convert_struct_index(lbModule *m, Type *t, i32 index) { if (t->kind == Type_Struct) { + if (t->Struct.is_raw_union) { + return 0; + } auto field_remapping = lb_get_struct_remapping(m, t); return field_remapping[index]; } else if (is_type_any(t) && build_context.ptr_size == 4) {