-
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
[ICE][miscompile] segv with combined atomic operation and nonnull pointer arithmetic in incremental build #123695
Comments
may be running into #123234 |
This started on stable in 1.73, and bisects to
A couple notes, when using cargo:
It would be interesting to see exactly what impacts codegen here when enabling incremental compilation of a single session (but at the same time, it seems probable that not many users should encounter this issue in the more common configurations?). |
This pull request partially reverts changes from e16c3b4 Original motivation for this assert was described with "A WorkProduct without a saved file is useless" which was true at the time but now it is possible to have work products with other types of files (llvm-ir, asm, etc) and there are bugreports for this failure: For example: rust-lang#123695 Fixes rust-lang#123234 Now existing `assert` and `.unwrap_or_else` are unified into a single check that emits slightly more user friendly error message if an object files was meant to be produced but it's missing
Allow workproducts without object files. This pull request partially reverts changes from e16c3b4 Original motivation for this assert was described with "A WorkProduct without a saved file is useless" which was true at the time but now it is possible to have work products with other types of files (llvm-ir, asm, etc) and there are bugreports for this failure: For example: rust-lang#123695 Fixes rust-lang#123234 Now existing `assert` and `.unwrap_or_else` are unified into a single check that emits slightly more user friendly error message if an object files was meant to be produced but it's missing
Rollup merge of rust-lang#124023 - pacak:less-splody, r=jieyouxu Allow workproducts without object files. This pull request partially reverts changes from e16c3b4 Original motivation for this assert was described with "A WorkProduct without a saved file is useless" which was true at the time but now it is possible to have work products with other types of files (llvm-ir, asm, etc) and there are bugreports for this failure: For example: rust-lang#123695 Fixes rust-lang#123234 Now existing `assert` and `.unwrap_or_else` are unified into a single check that emits slightly more user friendly error message if an object files was meant to be produced but it's missing
Some additional context: the code is largely related to ecow. In case people compile typst/ecow related code with incremental build and level 1 optimization enabled and run into segmentation fault, this should be the bug behind it. |
So the error happens just from adding Cc @rust-lang/wg-incr-comp Seems likely that the LLVM 17 update is involved. Cc @nikic |
I can confirm that this reproduces with an empty cache -- which should be good news in terms of debugging the issue. I'm pretty sure this is a ThinLTO-related bug and incremental somehow configures CGUs and LLVM settings in a way that triggers the bug. The segfault does not reproduce when compiling with |
Running the miscompiled binary in gdb (with Program received signal SIGSEGV, Segmentation fault.
main::main () at main.rs:52
52 drop(EcoVec::<Foo>::new()); |
Yeah, that would crash... |
I think this is a minimal reproducer: https://llvm.godbolt.org/z/49Kbq15xn
We infer that the result of this function is nonnull... |
Upstream issue: llvm/llvm-project#91177 |
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-high |
This bug is spotted jointly by @oxalica @Enter-tainer and @QuarticCat.
We tried this code (minimized by @QuarticCat and @oxalica):
I expected to see this happen: The program should exit without error.
Instead, this happened: segmentation fault.
cargo miri run
. (miri 0.1.0 (9d5cdf7 2024-04-07)
).opt-level
larger than0
.incremental
related, asrustc -Copt-level=3 bug.rs -o bug
does not reproduce the bug.cargo asm
produces different asm compared with the one in the ELF output.inc
directory can help):Meta
Both nightly and stable versions are affected
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: