-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
StorageDead is not dominated by StorageLive #98896
Comments
@rustbot claim |
@rustbot label +T-compiler +A-mir |
Ah, I think I just reported the same problem: #99085. |
In #99160 we are considering allowing redundant StorageLive; if we went that way, we would most probably want to keep allowing redundant StorageDead as well. |
@vakaras I'd also be interested to know if you have a reason for wanting this. I can't think of any real benefits myself, but I totally might be missing something |
I am working on a verifier for Rust called Prusti. Simply speaking, if I can treat |
So slightly generalizing this, I'm interpreting this as "I want to lower MIR to an IR which does not support these semantics" - this seems like a good reason to me. LLVM is not the only IR that MIR needs to be lowered to, SMIR, gcc, etc. are also there, and this might make sense for that reason. That being said, this is still not enough for the desired conclusion from the title that there is a dominance requirement. Indeed, even if we don't allow redundant storage markers, they are still dynamic statements, and so are allowed to be all kinds of wrong in dead code.
You can submit a PR to add your github tag here to be notified whenever a PR changes MIR semantics. |
Yes, exactly.
For Prusti, dead code is not a problem (as long as it is provably dead) because unreachable code is not analyzed. Whether it would be a problem for other compiler consumers, I do not know and would be open to discuss this.
Thanks! I just did that. |
@rustbot release-assignment |
…errors StorageLive: refresh storage (instead of UB) when local is already live Blocked on [this FCP](rust-lang#99160 (comment)), which also contains the motivation. Fixes rust-lang#99160 Fixes rust-lang#98896 (by declaring it not-a-bug) Fixes rust-lang#119366 Fixes rust-lang/unsafe-code-guidelines#129
Rollup merge of rust-lang#126154 - RalfJung:storage-live, r=compiler-errors StorageLive: refresh storage (instead of UB) when local is already live Blocked on [this FCP](rust-lang#99160 (comment)), which also contains the motivation. Fixes rust-lang#99160 Fixes rust-lang#98896 (by declaring it not-a-bug) Fixes rust-lang#119366 Fixes rust-lang/unsafe-code-guidelines#129
StorageLive: refresh storage (instead of UB) when local is already live Blocked on [this FCP](rust-lang/rust#99160 (comment)), which also contains the motivation. Fixes rust-lang/rust#99160 Fixes rust-lang/rust#98896 (by declaring it not-a-bug) Fixes rust-lang/rust#119366 Fixes rust-lang/unsafe-code-guidelines#129
As far as I understand, a
StorageDead
has to be dominated byStorageLive
. For this code (which is a simplified version of#[derive(PartialEq, Eq)]
onE
):This does not seem to be the case. I get the following MIR (
mir_dump/test.test.-------.renumber.0.mir
produced withrustc +nightly -Zdump-mir=all -Zdump-mir-dataflow=y -Zdump-mir-graphviz=y --crate-type lib test.rs
):The execution path
bb0 → bb1 → bb3
executesStorageDead(_6);
without executingStorageLive(_6);
, which, as far as I understand, is a bug.Meta
rustc --version --verbose
:Related issues
#68622
The text was updated successfully, but these errors were encountered: