aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorjoachimschmidt557 <joachim.schmidt557@outlook.com>2021-12-30 13:07:53 +0100
committerAndrew Kelley <andrew@ziglang.org>2021-12-30 15:12:38 -0500
commit726ee671befd06b18fec90a01dabf2eca96b2d02 (patch)
treeb44761d6e5062606dd1911cdd6c7b7fb4ed56506 /test
parent06286b05a41c6a6dcc28b62edfc41063e61e1588 (diff)
downloadzig-726ee671befd06b18fec90a01dabf2eca96b2d02.tar.gz
zig-726ee671befd06b18fec90a01dabf2eca96b2d02.zip
stage2 x86_64: add regression test for #7187
Diffstat (limited to 'test')
-rw-r--r--test/stage2/x86_64.zig21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/stage2/x86_64.zig b/test/stage2/x86_64.zig
index 3bb4aa01eb..ecc00bf499 100644
--- a/test/stage2/x86_64.zig
+++ b/test/stage2/x86_64.zig
@@ -1663,6 +1663,27 @@ pub fn addCases(ctx: *TestContext) !void {
);
}
}
+
+ {
+ var case = ctx.exe("issue 7187: miscompilation with bool return type", linux_x64);
+ case.addCompareOutput(
+ \\pub fn main() void {
+ \\ var x: usize = 1;
+ \\ var y: bool = getFalse();
+ \\ _ = y;
+ \\
+ \\ assert(x == 1);
+ \\}
+ \\
+ \\fn getFalse() bool {
+ \\ return false;
+ \\}
+ \\
+ \\fn assert(ok: bool) void {
+ \\ if (!ok) unreachable;
+ \\}
+ , "");
+ }
}
fn addLinuxTestCases(ctx: *TestContext) !void {