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-19 08:12:57+02:00
logfc7659fa55f232de90ef61ce8bd9a91cc1a9da14
tree28922959fdb26a2ca280a8f4252d7b97fea03fbe
parent3dbffc68862e545bd9fa1bbd317b2c93a6436561
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 {...@@ -1302,10 +1302,7 @@ pub fn abiSize(ty: Type, zcu: *const Zcu) u64 {
1302}1302}
13031303
1304pub fn ptrAbiAlignment(target: *const Target) Alignment {1304pub fn ptrAbiAlignment(target: *const Target) Alignment {
1305 // The eZ80 has 24-bit pointers, which aren't exact powers of two, tripping1305 return .fromNonzeroByteUnits(std.zig.target.intAlignment(target, target.ptrBitWidth()));
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));
1309}1306}
1310pub fn ptrAbiSize(target: *const Target) u64 {1307pub fn ptrAbiSize(target: *const Target) u64 {
1311 return @divExact(target.ptrBitWidth(), 8);1308 return @divExact(target.ptrBitWidth(), 8);