From 0c4ad1fda667a955df11aba294098153a1a1ba44 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Mon, 30 Mar 2020 14:10:39 -0400 Subject: [PATCH] Fix #69841 by updating LLVM submodule. Includes regression test for issue 69841. --- src/llvm-project | 2 +- src/test/ui/issues/issue-69841.rs | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 src/test/ui/issues/issue-69841.rs diff --git a/src/llvm-project b/src/llvm-project index 992e608cfc5d1..130721d6f4e6c 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 992e608cfc5d1c126a23c640222fd396a3bdeb9f +Subproject commit 130721d6f4e6cba3b910ccdf5e0aa62b9dffc95f diff --git a/src/test/ui/issues/issue-69841.rs b/src/test/ui/issues/issue-69841.rs new file mode 100644 index 0000000000000..942b99b742bc6 --- /dev/null +++ b/src/test/ui/issues/issue-69841.rs @@ -0,0 +1,30 @@ +// This is a regression test for issue rust-lang/rust#69841, which exposed an +// LLVM bug which needed a fix to be backported. + +// run-pass + +fn main() { + let buffer = [49u8, 10]; + let mut a : u64 = 0; + 'read: loop { + for c in &buffer { + match c { + 48..=57 => { + a*= 10; + a+= *c as u64 - 48; + } + 10 => { + break 'read; + } + _ => { + unsafe { std::hint::unreachable_unchecked() }; + } + } + } + } + if a == 1 { + println!("What did you expect?"); + } else { + panic!("this should be unreachable."); + } +}