-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
ICE: left: MutatingUse(Call), right: NonUse(VarDebugInfo)
#110902
Comments
Regression in rust-lang-ci@03c4280 |
@matthiaskrgr If you're saying my custom MIR is invalid and may never be generated by the normal pipeline, then it should be documented and ideally picked up by the validation pass. In any case, the problematic MIR can be generated from normal Rust and trigger the same ICE with pub fn a() -> i32 {
1
}
pub fn b(_: i32) {}
pub fn ice(arg: i32, discr: bool) -> i32 {
loop {
let mut c = 1;
let mut ret = a();
c = !arg;
ret = c;
if discr {
b(c);
return ret;
}
}
}
pub fn main() {
ice(1, false);
} |
cc @cjgillot and @JakobDegen who seem to know quite a bit about MIR optimisations? (I don't really know who's worked on these 😅) |
I see fuzzing is working :) . I'll take a look tonight |
Oh, and to confirm, yes - validation missing Mir that is not well-formed is a bug too, at least to the extent that that limitation of the validator is not known and clearly documented. |
Sorry, what I ment is this has always been crashing at least since custom mir supported it. |
@matthiaskrgr |
Found #111005 while looking at this - not the exact same issue though |
The linked PR disables the opt, which will mitigate the ICE. As I said there, the pass makes some sketchy assumptions, so this is not a super straight-forward fix. I'm not going to be looking at this though, someone else is free to pick it up. |
Disable nrvo mir opt See rust-lang#111005 and rust-lang#110902 . The ICE can definitely be hit on stable, the miscompilation I'm not sure about. The pass makes some pretty sketchy assumptions though, and we should not have it on while that's the case. I'm not going to work on actually fixing this, it's probably not excessively difficult though. r? rust-lang/mir-opt
Fortify and re-enable RNVO MIR opt Fixes rust-lang#111005 Fixes rust-lang#110902 This PR re-enables NRVO opt that had been disabled in rust-lang#111007 To look for RVO opportunities, we walk the MIR backwards from `return` terminators. In addition to the former implementation, we look at all the traversed statements and terminators for writes. If a local is written-to or moved-from, we discard it from the RVO candidates (`assigned_locals` bitset). If we see an indirect write or move, we discard all borrowed locals from candidates. cc `@JakobDegen`
Code
The crash probably has something to do with an MIR back edge to a basic block terminated by a
Call
withRET
as destination.This can only be triggered with
-Zmir-opt-level=2
. For some reason it doesn't happen with-Zmir-opt-level=3
Meta
rustc --version --verbose
:Error output
The text was updated successfully, but these errors were encountered: