| author | |
| committer | |
| log | 3ab845e028f464666856e4eaaeff2e6ab1b3da5d |
| tree | 5136997c2bde21445c1cfed42a0377be85f4d0c8 |
| parent | b4394412bb0f5d2ff0018fb9e868ccf0f46ab911 |
| signature |
it was calculating host integer size in a wrong way. just use integer
abi size2 files changed, 4 insertions(+), 11 deletions(-)
src/Type.zig+1-4| ... | @@ -3545,10 +3545,7 @@ pub fn packedStructFieldPtrInfo(struct_ty: Type, parent_ptr_ty: Type, field_idx: | ... | @@ -3545,10 +3545,7 @@ 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 | switch (zcu.comp.getZigBackend()) { | 3548 | @intCast(struct_ty.abiSize(zcu)), |
| 3549 | else => (running_bits + 7) / 8, | ||
| 3550 | .stage2_x86_64 => @intCast(struct_ty.abiSize(zcu)), | ||
| 3551 | }, | ||
| 3552 | bit_offset, | 3549 | bit_offset, |
| 3553 | }; | 3550 | }; |
| 3554 | 3551 |
test/behavior/union.zig+3-7| ... | @@ -1564,13 +1564,9 @@ test "packed union field pointer has correct alignment" { | ... | @@ -1564,13 +1564,9 @@ 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 | const host_size = switch (builtin.zig_backend) { | 1567 | comptime assert(@TypeOf(ap) == *align(4:2:@sizeOf(S)) u20); |
| 1568 | else => comptime std.math.divCeil(comptime_int, @bitSizeOf(S), 8) catch unreachable, | 1568 | comptime assert(@TypeOf(bp) == *align(1:2:@sizeOf(S)) u20); |
| 1569 | .stage2_x86_64 => @sizeOf(S), | 1569 | comptime assert(@TypeOf(cp) == *align(64:2:@sizeOf(S)) u20); |
| 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); | ||
| 1574 | 1570 | ||
| 1575 | a.u = .{ .x = 123 }; | 1571 | a.u = .{ .x = 123 }; |
| 1576 | b.u = .{ .x = 456 }; | 1572 | b.u = .{ .x = 456 }; |