authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-09-18 20:24:31+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-09-20 18:33:01-07:00
log20925f2957d6b3c4f8ac99c5cc96fb18f0612e4d
treee04e67ef80246cdeea2bfc0e511aaadf697d80a6
parentf81a721e4152ef514fd5ebf2f5fb39b97f844b4b

Revert "frontend: another packedStructFieldPtrInfo fix"

This reverts commit dedccecda944f88a5278c12c24ffbea46126de63.

2 files changed, 11 insertions(+), 4 deletions(-)

src/Type.zig+4-1
...@@ -3540,7 +3540,10 @@ pub fn packedStructFieldPtrInfo(...@@ -3540,7 +3540,10 @@ pub fn packedStructFieldPtrInfo(
3540 parent_ptr_info.packed_offset.host_size,3540 parent_ptr_info.packed_offset.host_size,
3541 parent_ptr_info.packed_offset.bit_offset + bit_offset,3541 parent_ptr_info.packed_offset.bit_offset + bit_offset,
3542 } else .{3542 } else .{
3543 @intCast(struct_ty.abiSize(zcu)),3543 switch (zcu.comp.getZigBackend()) {
3544 else => (running_bits + 7) / 8,
3545 .stage2_x86_64 => @intCast(struct_ty.abiSize(zcu)),
3546 },
3544 bit_offset,3547 bit_offset,
3545 };3548 };
35463549
test/behavior/union.zig+7-3
...@@ -1548,9 +1548,13 @@ test "packed union field pointer has correct alignment" {...@@ -1548,9 +1548,13 @@ test "packed union field pointer has correct alignment" {
1548 const bp = &b.u.x;1548 const bp = &b.u.x;
1549 const cp = &c.u.x;1549 const cp = &c.u.x;
15501550
1551 comptime assert(@TypeOf(ap) == *align(4:2:@sizeOf(S)) u20);1551 const host_size = switch (builtin.zig_backend) {
1552 comptime assert(@TypeOf(bp) == *align(1:2:@sizeOf(S)) u20);1552 else => comptime std.math.divCeil(comptime_int, @bitSizeOf(S), 8) catch unreachable,
1553 comptime assert(@TypeOf(cp) == *align(64:2:@sizeOf(S)) u20);1553 .stage2_x86_64 => @sizeOf(S),
1554 };
1555 comptime assert(@TypeOf(ap) == *align(4:2:host_size) u20);
1556 comptime assert(@TypeOf(bp) == *align(1:2:host_size) u20);
1557 comptime assert(@TypeOf(cp) == *align(64:2:host_size) u20);
15541558
1555 a.u = .{ .x = 123 };1559 a.u = .{ .x = 123 };
1556 b.u = .{ .x = 456 };1560 b.u = .{ .x = 456 };