Module: add allowzero canonicalization to pointer types

This commit is contained in:
Jacob Young
2023-05-29 22:22:05 -04:00
committed by Andrew Kelley
parent a803e9cf48
commit 27f1ad8afd

View File

@@ -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