You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> zig test safetest.zig
All 1 tests passed.
> zig test safetest.zig -O ReleaseFast
All 1 tests passed.
> zig test safetest.zig -O ReleaseSafe
slices differ. first difference occurs at index 0 (0x0)
============ expected this output: ============= len: 4 (0x4)
41 42 43 44 ABCD
============= instead found this: ============== len: 4 (0x4)
00 00 00 00 ....
================================================
1/1 safetest.test.test marshal/unmarshal with ReleaseSafe...FAIL (TestExpectedEqual)
0 passed; 0 skipped; 1 failed.
error: the following test command failed with exit code 1:
/Users/avoss/.cache/zig/o/5355486d8b426f44920699a773957766/test --seed=0xae458817
The bug is really above, but if you care to have a second bug that is potentially related to this, simply uncommenting this line in the above:
std.debug.print("anything\n", .{}); // somehow just printing eliminates the error? huh?
and then running the same tests, and what I believe would be the expected behavior happens again.
> zig test safetest.zig
anything
All 1 tests passed.
> zig test safetest.zig -O ReleaseFast
anything
All 1 tests passed.
> zig test safetest.zig -O ReleaseSafe
anything
All 1 tests passed.
Expected Behavior
I would expect both versions of the test to pass in all 3 build modes each.
The text was updated successfully, but these errors were encountered:
alanvoss
added
the
bug
Observed behavior contradicts documented or intended behavior
label
Dec 2, 2024
alanvoss
changed the title
ReleaseSafe on ptr align test differs on behavior with build mode ReleaseSafe
Ptr align test differs on behavior with build mode ReleaseSafe
Dec 2, 2024
alanvoss
changed the title
Ptr align test differs on behavior with build mode ReleaseSafe
Ptr align test has different behavior with build mode ReleaseSafe
Dec 2, 2024
Comparisons with undefined are illegal behavior (#63). got.* was copied from s, so got.*._ is undefined.
Branching on an @as(bool, undefined) (from comparing the fields _ which are undefined) in/calling std.testing.expectEqual is illegal behavior.
Besides missing safety in safe build modes, I don't think there is really a Zig bug here.
Zig Version
0.14.0-dev.1660+444228865
Steps to Reproduce and Observed Behavior
I'm running this on MacOS 15.1.1.
make a file called
safetest.zig
with the following contents:run as-is with 3 different test build modes:
The bug is really above, but if you care to have a second bug that is potentially related to this, simply uncommenting this line in the above:
and then running the same tests, and what I believe would be the expected behavior happens again.
Expected Behavior
I would expect both versions of the test to pass in all 3 build modes each.
The text was updated successfully, but these errors were encountered: