Closed
Description
Minimized from code in the Fuchsia tree:
fn main() {
enum Bits {
None = 0x00,
Low = 0x40,
High = 0x80,
Both = 0xC0,
}
let value = Box::new(0x40u8);
let mut out = Box::new(0u8);
let bits = match *value {
0x00 => Bits::None,
0x40 => Bits::Low,
0x80 => Bits::High,
0xC0 => Bits::Both,
_ => return,
};
match bits {
Bits::None | Bits::Low => {
*out = 1;
}
_ => (),
}
assert_eq!(*out, 1);
}
This issue was introduced in the nightly-2023-08-09
build, and so it is likely to be a result of the upgrade to LLVM 17 (#114048).
$ RUSTFLAGS="-Copt-level=1" cargo +nightly-2032-08-09 run
thread 'main' panicked at src/main.rs:27:5:
assertion `left == right` failed
left: 0
right: 1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
$ RUSTFLAGS="-Copt-level=1" cargo +nightly-2032-08-08 run
<passes>
Metadata
Metadata
Assignees
Labels
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generationCategory: This is a bug.Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessCritical priorityRelevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from stable to beta.