Skip to content
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

tests/run-make/repr128-dwarf panics when LLVM assertions are enabled #138254

Closed
ehuss opened this issue Mar 9, 2025 · 6 comments · Fixed by #138263
Closed

tests/run-make/repr128-dwarf panics when LLVM assertions are enabled #138254

ehuss opened this issue Mar 9, 2025 · 6 comments · Fixed by #138263
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ehuss
Copy link
Contributor

ehuss commented Mar 9, 2025

The following steps illustrate the tests/run-make/repr128-dwarf test failing (running on x86_64-unknown-linux-gnu):

git clone https://github.com/rust-lang/rust.git
cd rust
cat <<EOF > config.toml
profile = 'dist'
[llvm]
download-ci-llvm = 'if-unchanged'
assertions = true

[build]
optimized-compiler-builtins = true
cargo-native-static = true

[rust]
download-rustc = 'if-unchanged'
codegen-units-std = 1
channel = 'nightly'
verbose-tests = true
codegen-backends = ['llvm', 'cranelift']
lld = true
verify-llvm-ir = true
EOF
./x test tests/run-make/repr128-dwarf/rmake.rs

This fails with the following:

test [run-make] tests/run-make/repr128-dwarf ... FAILED

failures:

---- [run-make] tests/run-make/repr128-dwarf stdout ----

error: rmake recipe failed to complete
status: exit status: 101
command: cd "/home/eric/Temp/rust/build/x86_64-unknown-linux-gnu/test/run-make/repr128-dwarf/rmake_out" && env -u RUSTFLAGS AR="ar" BUILD_ROOT="/home/eric/Temp/rust/build/x86_64-unknow
n-linux-gnu" CARGO="/home/eric/Temp/rust/build/x86_64-unknown-linux-gnu/stage2-tools-bin/cargo" CC="cc" CC_DEFAULT_FLAGS="-ffunction-sections -fdata-sections -fPIC -m64" CXX="c++" CXX_
DEFAULT_FLAGS="-ffunction-sections -fdata-sections -fPIC -m64" HOST_RUSTC_DYLIB_PATH="/home/eric/Temp/rust/build/x86_64-unknown-linux-gnu/stage2/lib" LD_LIBRARY_PATH="/home/eric/Temp/r
ust/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/home/eric/Temp/rust/build/x86_64-unknown-linux-gnu/stage0/lib:/home/eric/Temp/rust/buil
d/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib" LD_LIB_PATH_ENVVAR="LD_LIBRARY_PATH" LLVM_BIN_DIR="/home/eric/Temp/rust/build/x86_64-unknown-linux-gnu/ci-ll
vm/bin" LLVM_COMPONENTS="aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser a
mdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgputargetmca amdgpuutils analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr
 avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo cfguard cgdata cod
egen codegentypes core coroutines coverage csky cskyasmparser cskycodegen cskydesc cskydisassembler cskyinfo debuginfobtf debuginfocodeview debuginfodwarf debuginfogsym debuginfologica
lview debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker dwarflinkerclassic dwarflinkerparallel dwp engine executionengine extensions filecheck frontendatomic frontenddriver
frontendhlsl frontendoffloading frontendopenacc frontendopenmp fuzzercli fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo hipst
dpar instcombine instrumentation interfacestub interpreter ipo irprinter irreader jitlink libdriver lineeditor linker loongarch loongarchasmparser loongarchcodegen loongarchdesc loonga
rchdisassembler loongarchinfo lto m68k m68kasmparser m68kcodegen m68kdesc m68kdisassembler m68kinfo mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdis
assembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts objco
py object objectyaml option orcdebugging orcjit orcshared orctargetprocess passes powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remark
s riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvtargetmca runtimedyld sandboxir scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparc
disassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target targetparser telemetry textapi textapibinar
yreader transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo webassemblyutils windowsdriver windowsmanif
est x86 x86asmparser x86codegen x86desc x86disassembler x86info x86targetmca xray xtensa xtensaasmparser xtensacodegen xtensadesc xtensadisassembler xtensainfo" LLVM_FILECHECK="/home/e
ric/Temp/rust/build/x86_64-unknown-linux-gnu/ci-llvm/bin/FileCheck" NODE="/usr/bin/node" PYTHON="/usr/bin/python3" RUSTC="/home/eric/Temp/rust/build/x86_64-unknown-linux-gnu/stage2/bin
/rustc" RUSTDOC="/home/eric/Temp/rust/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" SOURCE_ROOT="/home/eric/Temp/rust" TARGET="x86_64-unknown-linux-gnu" TARGET_EXE_DYLIB_PATH="/ho
me/eric/Temp/rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/eric/Temp/rust/build/x86_64-unknown-linux-gnu/test/run-make/repr128-dwarf/rmake
"
stdout: none
--- stderr -------------------------------

thread 'main' panicked at /home/eric/Temp/rust/tests/run-make/repr128-dwarf/rmake.rs:93:26:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
------------------------------------------



failures:
    [run-make] tests/run-make/repr128-dwarf

This was discovered while trying to merge #138200. However, I don't think that PR is directly related given the above reproduces on latest master (currently dea1661).

I can't explain why current CI is passing, given that the above reproduces the issue (for me).

This seems to be caused by #137643
cc @beetrees @jieyouxu @weihanglo

@ehuss ehuss added the C-bug Category: This is a bug. label Mar 9, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 9, 2025
@jieyouxu jieyouxu added A-testsuite Area: The testsuite used to check the correctness of rustc T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 9, 2025
@jieyouxu jieyouxu self-assigned this Mar 9, 2025
@jieyouxu jieyouxu removed the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Mar 9, 2025
@jieyouxu
Copy link
Member

jieyouxu commented Mar 9, 2025

The difference is LLVM debug assertions. If you toggle llvm.assertions to false to download "standard" CI LLVM, test passes. llvm.assertions = true downloads alt CI LLVM that has assertions, which changes the debuginfo enough to cause this test to fail.

I would be fine with reverting the test change (to unblock cargo subtree sync, then reland accounting for LLVM assertion differences).

@jieyouxu jieyouxu removed their assignment Mar 9, 2025
@jieyouxu
Copy link
Member

jieyouxu commented Mar 9, 2025

A more "minimal" profile to repro is

profile = 'compiler'

[llvm]
download-ci-llvm = true
assertions = true           # <- matters

[rust]
download-rustc = true       # not relevant, for faster test failure only
debug-assertions = false    # not relevant, for faster test failure only

@jieyouxu
Copy link
Member

jieyouxu commented Mar 9, 2025

I'm not sure why this passes in CI though. Surely we have some jobs that enable LLVM assertions? Seems like not, test jobs typically don't enable LLVM assertions due to slowness.

@jieyouxu jieyouxu changed the title tests/run-make/repr128-dwarf panics in some situations tests/run-make/repr128-dwarf panics when LLVM assertions are enabled Mar 9, 2025
@nikic
Copy link
Contributor

nikic commented Mar 9, 2025

I'm not sure why this passes in CI though. Surely we have some jobs that enable LLVM assertions? Seems like not, test jobs typically don't enable LLVM assertions due to slowness.

That doesn't sound right. LLVM assertions are supposed to be enabled for all test jobs, except those marked NO_LLVM_ASSERTIONS, which is only the apple ones.

@jieyouxu
Copy link
Member

jieyouxu commented Mar 9, 2025

I'll have to double check later.

@beetrees
Copy link
Contributor

beetrees commented Mar 9, 2025

For reference, this issue is being caused by debuginfo for std enums being included in the binary built by the test. Testing locally with the config from #138254 (comment), the issue seems to also require download-rustc.

@bors bors closed this as completed in 1105f4a Mar 9, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 9, 2025
Rollup merge of rust-lang#138263 - beetrees:fix-repr128-dwarf, r=jieyouxu

Fix `repr128-dwarf` test

The test now correctly ignores enums from `std`.

Fixes rust-lang#138254
Unblocks rust-lang#138200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants