Repository navigation
Closed
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)Area: Debugging information in compiled programs (DWARF, PDB, etc.)E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
The "conflicting locations for variable" bug might still be around in rust-1.84 and rust-1.85. A bunch of us on Gentoo are consistently hitting this same SIGABORT when compiling firefox with newer rust installs. It's always seemingly when running the exact same build step too, so it appears to be 100% reproducible.
I managed to get a stacktrace here, not sure if this might explain what we're seeing more:
https://bugs.gentoo.org/949280#c13
Rust is a bit outside of my realm of expertise, but if you'd like us to try running anything else on the workdir right after it fails, we'll try and offer any evidence that we can.
Originally posted by @yuri-sevatz in #131944
Metadata
Metadata
Assignees
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)Area: Debugging information in compiled programs (DWARF, PDB, etc.)E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Activity
jieyouxu commentedon Mar 8, 2025
Taking from the gentoo bug link for
=www-client/firefox-136.0 =dev-lang/rust-1.85.0:jieyouxu commentedon Mar 8, 2025
Potential reproducer according to the gentoo bug report is mls-platform-api v0.1.0 https://github.com/beurdouche/mls-platform-api?rev=19c3f18b747d13354370ba84440bb0b963932634#19c3f18b
khuey commentedon Mar 8, 2025
Are there STR that don't involve installing Gentoo?
I built 79b43df with LLVM assertions enabled, then used the stage 2 compiler to build mozilla/gecko-dev@e31c7b6 with
--enable-debug --enable optimize, and I didn't hit any assertions.jieyouxu commentedon Mar 9, 2025
cc @yuri-sevatz
yuri-sevatz commentedon Mar 9, 2025
Following steps from here:
#131944 (comment)
I manually re-ran the failing
rustcinvocation that portage had SIGABORT on earlier, only this time I added the one extra-C save-tempsargument described in the link above:It generated this:
... these files are attached in upload.zip below:
upload.zip
Here are the package versions which I had combined to get this, though others are saying it's the same result with
dev-lang/rust-1.84*:dev-lang/rust-1.85.0-r1dev-lang/rust-common-1.85.0www-client/firefox-1.36.0On this particular Gentoo installation, every package (including rust itself) would have been built with the below globals set in
/etc/portage/make.conf. CFLAGS/CXXFLAGS tend to affect everything that any compiler understands. CPU_FLAGS_X86 will affect only packages that include manually written steps to translate them to "build-system-specific" arguments.Since I've reproduced this on several other CPUs with a range of older as well as newer instruction sets, I don't think the above globals
/etc/portage/make.confmatter that much.Hope that helps... I'll try and see if it's easy to hit this with Gentoo's livecd. Their "GUI" livecd might be a little closer to being able to test this with a lot less steps, provided you have the RAM for it.
khuey commentedon Mar 9, 2025
awslabs/mls-rs#231 looks potentially relevant
khuey commentedon Mar 9, 2025
Yeah reverting that and then doing
CARGO_PROFILE_RELEASE_DEBUG=2 RUSTC=<rustc with LLVM assertions enabled> cargo build --release --examplestriggers the assertion.yuri-sevatz commentedon Mar 9, 2025
I have confirmed that applying the same workaround to the 'mls-platform-api' folder in firefox's source code avoids the crash in rustc when compiling Gentoo's version of
www-client/firefox-136.0.khuey commentedon Mar 9, 2025
Unfortunately the assertion goes away with
-Ccodegen-units=1, which also means it goes away with--emit=llvm-ir.khuey commentedon Mar 9, 2025
Notably this asserts on 026e9ed i.e. the commit before #128861.
khuey commentedon Mar 11, 2025
Disabling LTO also makes this go away.
@rustbot label A-LTO
khuey commentedon Mar 11, 2025
Alright, after further investigation I think the LTO is just required to get SROA aggressive enough to trigger the assertion but isn't actually the root cause.
@rustbot label -A-LTO
The hacky commit that obscures this problem replaces the destructuring assignment
with a
mem::replacecallThat destructuring assignment is critical to tripping the assertion. Rustc desugars that assignment to
Note the repeated
lhs. By the time we get to MIR these get broken into separate stack slots like soand codegen proceeds the way one would expect. But that double
lhscomes back to haunt us during debuginfo generation.rustc assigns both stack slots to the same DILocalVariable. Then, when the type is a struct (Vec in the repo in question) and SROA is aggressive enough to shred one of them into its constituents, the assertion is triggered.
That's a lot to unpack, but my first question is why are we generating debuginfo for compiler-introduced-vars at all?
Don't produce debug information for compiler-introduced-vars when des…
khuey commentedon Mar 24, 2025
@rustbot claim
Rollup merge of rust-lang#138818 - khuey:138198, r=jieyouxu
Rollup merge of rust-lang#138818 - khuey:138198, r=jieyouxu
Unrolled build for rust-lang#138818