Auto merge of #77549 - tmiasko:simplify-branch-same-fix, r=oli-obk
Fix miscompile in SimplifyBranchSame Cherry-picked from #77486, but with a different test case that used to be compiled incorrectly on both master & beta branches.
This commit is contained in:
commit
d890e64dff
2 changed files with 23 additions and 1 deletions
21
src/test/ui/mir/simplify-branch-same.rs
Normal file
21
src/test/ui/mir/simplify-branch-same.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// Regression test for SimplifyBranchSame miscompilation.
|
||||
// run-pass
|
||||
|
||||
macro_rules! m {
|
||||
($a:expr, $b:expr, $c:block) => {
|
||||
match $a {
|
||||
Lto::Fat | Lto::Thin => { $b; (); $c }
|
||||
Lto::No => { $b; () }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub enum Lto { No, Thin, Fat }
|
||||
|
||||
fn f(mut cookie: u32, lto: Lto) -> u32 {
|
||||
let mut _a = false;
|
||||
m!(lto, _a = true, {cookie = 0});
|
||||
cookie
|
||||
}
|
||||
|
||||
fn main() { assert_eq!(f(42, Lto::Thin), 0) }
|
||||
Loading…
Add table
Add a link
Reference in a new issue