Skip to content

Commit f271957

Browse files
committedOct 4, 2020
Add regression test for SimplifyBranchSame miscompilation
1 parent 80d5017 commit f271957

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
 
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Regression test for SimplifyBranchSame miscompilation.
2+
// run-pass
3+
4+
macro_rules! m {
5+
($a:expr, $b:expr, $c:block) => {
6+
match $a {
7+
Lto::Fat | Lto::Thin => { $b; (); $c }
8+
Lto::No => { $b; () }
9+
}
10+
}
11+
}
12+
13+
pub enum Lto { No, Thin, Fat }
14+
15+
fn f(mut cookie: u32, lto: Lto) -> u32 {
16+
let mut _a = false;
17+
m!(lto, _a = true, {cookie = 0});
18+
cookie
19+
}
20+
21+
fn main() { assert_eq!(f(42, Lto::Thin), 0) }

0 commit comments

Comments
 (0)
Please sign in to comment.