authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-03-06 16:30:56+00:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-03-10 10:38:51+00:00
logf92b998f9fe985d554d6078bb2bb11d094d94b91
tree62b942e26572bd859e2253bb1c3ed180835d8c37
parent1293f080fdfc74966b541b44f0a907561df3d617
signaturelock-open Commit is signed but in an unrecognized format.

behavior: disable some tests under the C backend targeting MSVC

The bugs here actually exist on master branch too, but they are being caught by the new static assertions which check type size and alignment. It turns out that MSVC's struct/union "pack" pragma and its "align" declspec interact in undocumented ways which are extremely problematic for generated code. Solving this will require changing how the C backend lowers various types; the disabled tests are all tagged unions, but there are also issues with structs with underaligned fields which the behavior tests just happen to not currently be triggering.

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

test/behavior/align.zig+1
...@@ -18,6 +18,7 @@ test "global variable alignment" {...@@ -18,6 +18,7 @@ test "global variable alignment" {
18test "large alignment of local constant" {18test "large alignment of local constant" {
19 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;19 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
20 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; // flaky20 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; // flaky
21 if (builtin.zig_backend == .stage2_c and builtin.target.abi == .msvc) return error.SkipZigTest;
2122
22 const x: f32 align(128) = 12.34;23 const x: f32 align(128) = 12.34;
23 try std.testing.expect(@intFromPtr(&x) % 128 == 0);24 try std.testing.expect(@intFromPtr(&x) % 128 == 0);
test/behavior/union.zig+2
...@@ -148,6 +148,7 @@ const err = @as(anyerror!Agg, Agg{...@@ -148,6 +148,7 @@ const err = @as(anyerror!Agg, Agg{
148const array = [_]Value{ v1, v2, v1, v2 };148const array = [_]Value{ v1, v2, v1, v2 };
149149
150test "unions embedded in aggregate types" {150test "unions embedded in aggregate types" {
151 if (builtin.zig_backend == .stage2_c and builtin.target.abi == .msvc) return error.SkipZigTest;
151 switch (array[1]) {152 switch (array[1]) {
152 Value.Array => |arr| try expect(arr[4] == 3),153 Value.Array => |arr| try expect(arr[4] == 3),
153 else => unreachable,154 else => unreachable,
...@@ -2022,6 +2023,7 @@ test "runtime union init, most-aligned field != largest" {...@@ -2022,6 +2023,7 @@ test "runtime union init, most-aligned field != largest" {
2022 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO2023 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
2023 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;2024 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
2024 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;2025 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
2026 if (builtin.zig_backend == .stage2_c and builtin.target.abi == .msvc) return error.SkipZigTest;
20252027
2026 const U = union(enum) {2028 const U = union(enum) {
2027 x: u128,2029 x: u128,