Commit 5a62f26579
Changed files (2)
src
arch
x86_64
test
behavior
src/arch/x86_64/CodeGen.zig
@@ -6993,7 +6993,7 @@ fn packedLoad(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) Inn
if (val_abi_size > 8) return self.fail("TODO implement packed load of {}", .{val_ty.fmt(mod)});
- const limb_abi_size: u32 = @min(val_abi_size, 8);
+ const limb_abi_size: u31 = @min(val_abi_size, 8);
const limb_abi_bits = limb_abi_size * 8;
const val_byte_off: i32 = @intCast(ptr_bit_off / limb_abi_bits * limb_abi_size);
const val_bit_off = ptr_bit_off % limb_abi_bits;
@@ -7041,7 +7041,7 @@ fn packedLoad(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) Inn
.base = .{ .reg = ptr_reg },
.mod = .{ .rm = .{
.size = Memory.Size.fromSize(val_abi_size),
- .disp = val_byte_off + 1,
+ .disp = val_byte_off + limb_abi_size,
} },
});
try self.spillEflagsIfOccupied();
test/behavior/packed-struct.zig
@@ -1130,10 +1130,6 @@ test "pointer loaded correctly from packed struct" {
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
- if (builtin.zig_backend == .stage2_x86_64) {
- // Careful enabling this test, fails randomly.
- return error.SkipZigTest;
- }
var ram = try RAM.new();
var cpu = try CPU.new(&ram);