stage2 x86_64: add regression test for #7187

This commit is contained in:
joachimschmidt557 2021-12-30 13:07:53 +01:00 committed by Andrew Kelley
parent 06286b05a4
commit 726ee671be

View File

@ -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 {