authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-03-02 17:40:37+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-03-02 17:40:37+01:00
log77072d1a1785f389c3c9918c6d7c6179ac2e43f4
tree1afb2b62fbefe367a329ead59c266428ead66738
parentb0bb1583cb03e2125b2b407d762baf42e7cfd527

x64: fix bug in lowering optionals directly to immediate


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

src/arch/x86_64/CodeGen.zig+1-1
...@@ -5688,7 +5688,7 @@ fn genTypedValue(self: *Self, typed_value: TypedValue) InnerError!MCValue {...@@ -5688,7 +5688,7 @@ fn genTypedValue(self: *Self, typed_value: TypedValue) InnerError!MCValue {
5688 .val = typed_value.val,5688 .val = typed_value.val,
5689 });5689 });
5690 } else if (typed_value.ty.abiSize(self.target.*) == 1) {5690 } else if (typed_value.ty.abiSize(self.target.*) == 1) {
5691 return MCValue{ .immediate = @boolToInt(typed_value.val.isNull()) };5691 return MCValue{ .immediate = @boolToInt(!typed_value.val.isNull()) };
5692 }5692 }
5693 },5693 },
5694 .Enum => {5694 .Enum => {
test/behavior/cast.zig+1-1
...@@ -179,7 +179,7 @@ test "@floatCast comptime_int and comptime_float" {...@@ -179,7 +179,7 @@ test "@floatCast comptime_int and comptime_float" {
179179
180test "coerce undefined to optional" {180test "coerce undefined to optional" {
181 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;181 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
182 if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;182 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
183183
184 try expect(MakeType(void).getNull() == null);184 try expect(MakeType(void).getNull() == null);
185 try expect(MakeType(void).getNonNull() != null);185 try expect(MakeType(void).getNonNull() != null);