authorgravatar for paul.verigo@gmail.comPavel Verigo <paul.verigo@gmail.com> 2026-10-18 18:29:34+02:00
committergravatar for paul.verigo@gmail.comPavel Verigo <paul.verigo@gmail.com> 2026-10-20 23:10:13+02:00
log151597cc0dcfcad384218a2b92cae4b23b11ebe6
treec677ece6fd67be7c889eb588b9df357a00449c0c
parent29c18b40dcb74789ed054e9fe599a4a8f644b08e

x86_64: fix repr of ?error


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

src/codegen/x86_64/CodeGen.zig+9-11
...@@ -181803,17 +181803,15 @@ fn intInfo(cg: *CodeGen, ty: Type) ?std.lang.Type.Int {...@@ -181803,17 +181803,15 @@ fn intInfo(cg: *CodeGen, ty: Type) ?std.lang.Type.Int {
181803 .one, .many, .c => .{ .signedness = .unsigned, .bits = cg.target.ptrBitWidth() },181803 .one, .many, .c => .{ .signedness = .unsigned, .bits = cg.target.ptrBitWidth() },
181804 .slice => null,181804 .slice => null,
181805 },181805 },
181806 .opt_type => |opt_child| return if (!Type.fromInterned(opt_child).hasRuntimeBits(zcu))181806 .opt_type => |opt_child| {
181807 .{ .signedness = .unsigned, .bits = 1 }181807 if (!Type.fromInterned(opt_child).hasRuntimeBits(zcu)) {
181808 else switch (ip.indexToKey(opt_child)) {181808 return .{ .signedness = .unsigned, .bits = 1 };
181809 .ptr_type => |ptr_type| switch (ptr_type.flags.size) {181809 }
181810 .one, .many => switch (ptr_type.flags.is_allowzero) {181810 if (Type.fromInterned(ty_index).optionalReprIsPayload(zcu)) {
181811 false => .{ .signedness = .unsigned, .bits = cg.target.ptrBitWidth() },181811 ty_index = opt_child;
181812 true => null,181812 continue;
181813 },181813 }
181814 .slice, .c => null,181814 return null;
181815 },
181816 else => null,
181817 },181815 },
181818 .error_union_type => |error_union_type| return if (!Type.fromInterned(error_union_type.payload_type)181816 .error_union_type => |error_union_type| return if (!Type.fromInterned(error_union_type.payload_type)
181819 .hasRuntimeBits(zcu)) .{ .signedness = .unsigned, .bits = zcu.errorSetBits() } else null,181817 .hasRuntimeBits(zcu)) .{ .signedness = .unsigned, .bits = zcu.errorSetBits() } else null,
test/behavior/optional.zig+1
...@@ -59,6 +59,7 @@ fn testNullPtrsEql() !void {...@@ -59,6 +59,7 @@ fn testNullPtrsEql() !void {
59}59}
6060
61test "optional error equality" {61test "optional error equality" {
62 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
62 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;63 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
63 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest;64 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest;
64 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;65 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;