frontend: another packedStructFieldPtrInfo fix

it was calculating host integer size in a wrong way. just use integer
abi size
This commit is contained in:
Andrew Kelley
2025-09-10 14:56:04 -07:00
committed by Alex Rønne Petersen
parent b4394412bb
commit 3ab845e028
2 changed files with 4 additions and 11 deletions

View File

@@ -1564,13 +1564,9 @@ test "packed union field pointer has correct alignment" {
const bp = &b.u.x;
const cp = &c.u.x;
const host_size = switch (builtin.zig_backend) {
else => comptime std.math.divCeil(comptime_int, @bitSizeOf(S), 8) catch unreachable,
.stage2_x86_64 => @sizeOf(S),
};
comptime assert(@TypeOf(ap) == *align(4:2:host_size) u20);
comptime assert(@TypeOf(bp) == *align(1:2:host_size) u20);
comptime assert(@TypeOf(cp) == *align(64:2:host_size) u20);
comptime assert(@TypeOf(ap) == *align(4:2:@sizeOf(S)) u20);
comptime assert(@TypeOf(bp) == *align(1:2:@sizeOf(S)) u20);
comptime assert(@TypeOf(cp) == *align(64:2:@sizeOf(S)) u20);
a.u = .{ .x = 123 };
b.u = .{ .x = 456 };