From 822c3a48197d2e5ce880fd2043e71415e04ae759 Mon Sep 17 00:00:00 2001 From: paulsnar Date: Mon, 3 Jan 2022 21:23:50 +0200 Subject: [PATCH] stage1: Resolve LLVM C ABI type for small packed structs Small packed structs weren't included in this resolution so their c_abi_type would be NULL when attempting usage later, leading to a compiler crash. Resolves #10431. --- src/stage1/analyze.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stage1/analyze.cpp b/src/stage1/analyze.cpp index 3b8d71db32..a64a6e34fb 100644 --- a/src/stage1/analyze.cpp +++ b/src/stage1/analyze.cpp @@ -8962,7 +8962,7 @@ static void resolve_llvm_types_struct(CodeGen *g, ZigType *struct_type, ResolveS struct_type->data.structure.llvm_full_type_queue_index = SIZE_MAX; } - if (struct_type->abi_size <= 16 && struct_type->data.structure.layout == ContainerLayoutExtern) + if (struct_type->abi_size <= 16 && (struct_type->data.structure.layout == ContainerLayoutExtern || struct_type->data.structure.layout == ContainerLayoutPacked)) resolve_llvm_c_abi_type(g, struct_type); }