Closed
Description
fn main() {
let mut a;
let mut b;
let mut c;
let d = false;
let mut p = &raw const d;
loop {
a = !unsafe { *p };
b = !unsafe { *p };
c = a;
p = &c as *const _;
assert_eq!({a}, {b});
}
}
$ rustc a.rs -Cdebug-assertions=off -Zmir-opt-level=0 && ./a
# Program terminated manually. OK.
$ rustc a.rs -Cdebug-assertions=off && ./a
thread 'main' panicked at a.rs:12:9:
assertion `left == right` failed
left: false
right: true
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Metadata
Metadata
Assignees
Labels
Area: MIR optimizationsCategory: This is a bug.Issue: Correct Rust code lowers to incorrect machine codeIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessStatus: A bisection has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueRelevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from stable to beta.