From 27f1ad8afde86c8f734deeb05f5c8cad910275e4 Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Mon, 29 May 2023 22:22:05 -0400 Subject: Module: add allowzero canonicalization to pointer types --- src/Module.zig | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/Module.zig') diff --git a/src/Module.zig b/src/Module.zig index 22ac947cdf..ffc6a95fe1 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -6683,6 +6683,8 @@ pub fn ptrType(mod: *Module, info: InternPool.Key.PtrType) Allocator.Error!Type var canon_info = info; const have_elem_layout = info.elem_type.toType().layoutIsResolved(mod); + if (info.size == .C) canon_info.is_allowzero = true; + // Canonicalize non-zero alignment. If it matches the ABI alignment of the pointee // type, we change it to 0 here. If this causes an assertion trip because the // pointee type needs to be resolved more, that needs to be done before calling -- cgit v1.2.3