authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-12-05 20:45:27-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-01-09 14:59:28-07:00
logbb957a976d214915c51d72a8112ef905a3777602
tree630578a2efdfef354f74af0572a48f42a1cbb122
parentf8f65aebe6f16a84af9f694a224dcf9bb1bc40b6

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.

1 files changed, 1 insertions(+), 1 deletions(-)

src/Sema.zig+1-1
......@@ -32405,7 +32405,7 @@ fn elemPtrType(sema: *Sema, ptr_ty: Type, offset: ?usize) !Type {
3240532405 }
3240632406 // If the addend is not a comptime-known value we can still count on
3240732407 // it being a multiple of the type size.
32408 const elem_size = elem_ty.abiSize(target);
32408 const elem_size = try sema.typeAbiSize(elem_ty);
3240932409 const addend = if (offset) |off| elem_size * off else elem_size;
3241032410
3241132411 // The resulting pointer is aligned to the lcd between the offset (an