-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Another mir-opt-level=4 miscompilation #91725
Comments
What is this mir-opt-level=4? Is this new? I have only heard of up to 0-3. |
I think the old "mir-opt-level=3" got renamed "-Z mir-opt-level=4" recently, few months ago. I think they got shifted by +1 :-) |
fn main() {
let a = true;
let _ = &a;
let mut b = false;
b |= a;
assert!(b);
} $ rustc a.rs -Zmir-opt-level=4 && ./a
thread 'main' panicked at 'assertion failed: b', a.rs:6:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
Is that a minimization? In the original code I think there are no references "&a". |
The
When a reference to a local variable is taken, the const propagator considers its value to be unknown. The example takes a reference to |
This is a bad bug report because the code to reproduce it is long. But I'm bad at spotting what the problem is here.
If I compile this code with
rustc -O -Z mir-opt-level=3 test.rs
It runs very quickly. If I compile it with:
rustc -O -Z mir-opt-level=4 test.rs
I think it goes into an infinite loop.
I think the miscompilation problem is in the "while b != 1" loop inside the residue() function.
I've seen that the asm for the residue() function (adding inline(never) to residue() and jacobi()) gets quite shorter if I use opt-level=4.
Using:
The text was updated successfully, but these errors were encountered: