| author | |
| committer | |
| log | 9694c83b954d1bd4a3f224ef69d75639e6da56c7 |
| tree | 23a1255641ca484c302e1d53a64d20b491a45b90 |
| parent | d07b67a55cba683c7adb73f5e2f7b1bec803a361 |
| signature |
This reverts commit 3ab845e028f464666856e4eaaeff2e6ab1b3da5d.2 files changed, 11 insertions(+), 4 deletions(-)
src/Type.zig+4-1| ... | @@ -3545,7 +3545,10 @@ pub fn packedStructFieldPtrInfo(struct_ty: Type, parent_ptr_ty: Type, field_idx: | ... | @@ -3545,7 +3545,10 @@ pub fn packedStructFieldPtrInfo(struct_ty: Type, parent_ptr_ty: Type, field_idx: |
| 3545 | parent_ptr_info.packed_offset.host_size, | 3545 | parent_ptr_info.packed_offset.host_size, |
| 3546 | parent_ptr_info.packed_offset.bit_offset + bit_offset, | 3546 | parent_ptr_info.packed_offset.bit_offset + bit_offset, |
| 3547 | } else .{ | 3547 | } else .{ |
| 3548 | @intCast(struct_ty.abiSize(zcu)), | 3548 | switch (zcu.comp.getZigBackend()) { |
| 3549 | else => (running_bits + 7) / 8, | ||
| 3550 | .stage2_x86_64 => @intCast(struct_ty.abiSize(zcu)), | ||
| 3551 | }, | ||
| 3549 | bit_offset, | 3552 | bit_offset, |
| 3550 | }; | 3553 | }; |
| 3551 | 3554 |
test/behavior/union.zig+7-3| ... | @@ -1564,9 +1564,13 @@ test "packed union field pointer has correct alignment" { | ... | @@ -1564,9 +1564,13 @@ test "packed union field pointer has correct alignment" { |
| 1564 | const bp = &b.u.x; | 1564 | const bp = &b.u.x; |
| 1565 | const cp = &c.u.x; | 1565 | const cp = &c.u.x; |
| 1566 | 1566 | ||
| 1567 | comptime assert(@TypeOf(ap) == *align(4:2:@sizeOf(S)) u20); | 1567 | const host_size = switch (builtin.zig_backend) { |
| 1568 | comptime assert(@TypeOf(bp) == *align(1:2:@sizeOf(S)) u20); | 1568 | else => comptime std.math.divCeil(comptime_int, @bitSizeOf(S), 8) catch unreachable, |
| 1569 | comptime assert(@TypeOf(cp) == *align(64:2:@sizeOf(S)) u20); | 1569 | .stage2_x86_64 => @sizeOf(S), |
| 1570 | }; | ||
| 1571 | comptime assert(@TypeOf(ap) == *align(4:2:host_size) u20); | ||
| 1572 | comptime assert(@TypeOf(bp) == *align(1:2:host_size) u20); | ||
| 1573 | comptime assert(@TypeOf(cp) == *align(64:2:host_size) u20); | ||
| 1570 | 1574 | ||
| 1571 | a.u = .{ .x = 123 }; | 1575 | a.u = .{ .x = 123 }; |
| 1572 | b.u = .{ .x = 456 }; | 1576 | b.u = .{ .x = 456 }; |