authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-10-19 08:12:57+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-10-20 10:02:55+02:00
loge4c7fc58a54d8ca25db92846f09c089bc58e1f04
tree8930115c849f5de1eebf43513a1c5a70517f140e
parent4cf3a1d89789ef96c90862b52596c2d9f673a951
signature Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

compiler: fix ptrAbiAlignment() for esoteric targets

This should really just ask for the integer alignment of the pointer bit width, thus avoiding the target-specific special cases we'd otherwise have to insert here, e.g. for avr and spork8 in addition to ez80.

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

src/Type.zig+1-4
......@@ -1302,10 +1302,7 @@ pub fn abiSize(ty: Type, zcu: *const Zcu) u64 {
13021302}
13031303
13041304pub fn ptrAbiAlignment(target: *const Target) Alignment {
1305 // The eZ80 has 24-bit pointers, which aren't exact powers of two, tripping
1306 // the assert. The alignment of eZ80 pointers is 1, so we bypass the check.
1307 if (target.cpu.arch == .ez80) return .@"1";
1308 return .fromNonzeroByteUnits(@divExact(target.ptrBitWidth(), 8));
1305 return .fromNonzeroByteUnits(std.zig.target.intAlignment(target, target.ptrBitWidth()));
13091306}
13101307pub fn ptrAbiSize(target: *const Target) u64 {
13111308 return @divExact(target.ptrBitWidth(), 8);