diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-07-05 15:21:43 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-07-05 15:22:19 -0700 |
| commit | 388520a40b866dc43cd130fcbaeda866ccd4217e (patch) | |
| tree | b779ee306b210986d6748782f347922a591819c1 /test/behavior | |
| parent | 2ee864ca5eb46468e8e0f4237a5532b76b60d715 (diff) | |
| download | zig-388520a40b866dc43cd130fcbaeda866ccd4217e.tar.gz zig-388520a40b866dc43cd130fcbaeda866ccd4217e.zip | |
fix behavior test which was relying on UB
Diffstat (limited to 'test/behavior')
| -rw-r--r-- | test/behavior/bugs/9584.zig | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/test/behavior/bugs/9584.zig b/test/behavior/bugs/9584.zig index 709d510072..503a402fed 100644 --- a/test/behavior/bugs/9584.zig +++ b/test/behavior/bugs/9584.zig @@ -35,7 +35,8 @@ pub fn a( _ = flag_a; // With this bug present, `flag_b` would actually contain the value 17. // Note: this bug only presents itself on debug mode. - try std.testing.expect(@ptrCast(*const u8, &flag_b).* == 1); + const flag_b_byte: u8 = @boolToInt(flag_b); + try std.testing.expect(flag_b_byte == 1); } pub fn b(x: *X) !void { |
