authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-05-29 22:22:05-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-06-10 20:47:57-07:00
log27f1ad8afde86c8f734deeb05f5c8cad910275e4
tree7f81cb0a496f8fc682b7cc106684d4ecbf2b3192
parenta803e9cf48e9566638e6ec1e23fe0b885e2651ee

Module: add allowzero canonicalization to pointer types


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

src/Module.zig+2
...@@ -6683,6 +6683,8 @@ pub fn ptrType(mod: *Module, info: InternPool.Key.PtrType) Allocator.Error!Type...@@ -6683,6 +6683,8 @@ pub fn ptrType(mod: *Module, info: InternPool.Key.PtrType) Allocator.Error!Type
6683 var canon_info = info;6683 var canon_info = info;
6684 const have_elem_layout = info.elem_type.toType().layoutIsResolved(mod);6684 const have_elem_layout = info.elem_type.toType().layoutIsResolved(mod);
66856685
6686 if (info.size == .C) canon_info.is_allowzero = true;
6687
6686 // Canonicalize non-zero alignment. If it matches the ABI alignment of the pointee6688 // Canonicalize non-zero alignment. If it matches the ABI alignment of the pointee
6687 // type, we change it to 0 here. If this causes an assertion trip because the6689 // type, we change it to 0 here. If this causes an assertion trip because the
6688 // pointee type needs to be resolved more, that needs to be done before calling6690 // pointee type needs to be resolved more, that needs to be done before calling