From 36da3000c0076c5a2bd0b2258718510cf11dd3e2 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 5 Dec 2022 20:45:27 -0700 Subject: [PATCH] Sema: resolve elem type for non-default aligned ptrs Before this commit, I observe a crash from this abiSize call because the element type is a struct that is not yet resolved. This is triggered by running the behavior tests with -ofmt=c -target x86_64-windows. --- src/Sema.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Sema.zig b/src/Sema.zig index 295b46578e099c8e2d6cd5740a73141ffe2338ee..debd18005abb978d40041c42cfbc10ec15b488de 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -32535,7 +32535,7 @@ fn elemPtrType(sema: *Sema, ptr_ty: Type, offset: ?usize) !Type { } // If the addend is not a comptime-known value we can still count on // it being a multiple of the type size. - const elem_size = elem_ty.abiSize(target); + const elem_size = try sema.typeAbiSize(elem_ty); const addend = if (offset) |off| elem_size * off else elem_size; // The resulting pointer is aligned to the lcd between the offset (an -- 2.54.0