-
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
Internal Compiler Error: 'attempt to subtract with overflow', compiler/rustc_session/src/session.rs:478:22 #84219
Comments
The ICE is a regression, introduced in #82720. The overflowing subtraction happens here: rust/compiler/rustc_session/src/session.rs Lines 470 to 479 in 0894d1e
|
Assigning priority as discussed as part of the Prioritization Working Group procedure and removing @rustbot label -I-prioritize +P-medium |
This regression will unfortunately be included in 1.52.0 stable. Updating the labels. |
This was discussed a bit on Zulip here. I did a small amount of investigation, and found that the code that checks if "errors were generated" does not handle stashed errors correctly. It keeps a count of errors, but with stashed errors that count can go up and down at various times. In this particular case, an error is stashed and then stolen. The comment on the relevant function ("Remove this method, it should never be needed.") isn't really clear why it shouldn't be needed. In general, that error tracking logic needs to change to handle stashed errors correctly. |
@ehuss |
…_checks, r=Mark-Simulacrum Add config.toml options for enabling overflow checks in rustc and std The names are `overflow-checks` and `overflow-checks-std` and they work similar to `debug-assertions` and `debug-assertions-std`. Once added we can measure how big the performance impact actually is and maybe enable them for CI tests. Enabling them already makes two ui tests fail: ``` failures: [ui] ui/parser/item-free-const-no-body-semantic-fail.rs [ui] ui/parser/item-free-static-no-body-semantic-fail.rs ``` (See rust-lang#84219 and rust-lang#87761.)
…=Mark-Simulacrum Fix overflow in rustc happening if the `err_count()` is reduced in a stage. This can happen if stashed diagnostics are removed or replaced with fewer errors. The semantics stay the same if built without overflow checks. Fixes rust-lang#84219. Background: I came across this independently by running `RUSTFLAGS="-C overflow-checks=on" ./x.py test`. Fixing this will allow us to move on and find further overflow errors with testing or fuzzing.
Build
rustc
with overflow checking enabled:Then try compiling the following program (found by fuzz-rustc):
The text was updated successfully, but these errors were encountered: