Skip to content

llvm segfaults during bootstrap of rustc_middle in stage 1 #76213

Closed
@matthiaskrgr

Description

@matthiaskrgr

When bootstrapping rustc, I can observe a crash inside llvm when building stage 1 rustc_middle.

  error: could not compile `rustc_middle`.

Caused by:
  process didn't exit successfully: `/home/matthias/.cargo/bin/sccache /home/matthias/vcs/github/rust/build/bootstrap/debug/rustc --crate-name rustc_middle --edition=2018 compiler/rustc_middle/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -Cembed-bitcode=no -C codegen-units=4 -C debuginfo=0 -C metadata=d04a1078c718a5ca -C extra-filename=-d04a1078c718a5ca --out-dir /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/release/deps --extern bitflags=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libbitflags-70d28355c7ba065c.rmeta --extern byteorder=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libbyteorder-e3dd620d9578e39d.rmeta --extern chalk_ir=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libchalk_ir-c1f762b67e0905bf.rmeta --extern measureme=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libmeasureme-36a1068e4a5ba5a7.rmeta --extern polonius_engine=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libpolonius_engine-9c9005f4c2ee0bc8.rmeta --extern rustc_rayon_core=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_rayon_core-837c6250b0008557.rmeta --extern rustc_apfloat=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_apfloat-f41ce9e4d2735cf3.rmeta --extern rustc_arena=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_arena-2e633fc954377d89.rmeta --extern rustc_ast=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_ast-178de7fd822a2b16.rmeta --extern rustc_attr=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_attr-a692c7c6d2859faa.rmeta --extern rustc_data_structures=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-277b9d6f8e7c56be.rmeta --extern rustc_errors=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-04226f690745f132.rmeta --extern rustc_feature=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_feature-540909ef5385f3a4.rmeta --extern rustc_hir=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_hir-4fe87b7e14efe82a.rmeta --extern rustc_index=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_index-725f016597ca9da3.rmeta --extern rustc_macros=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/release/deps/librustc_macros-66fc5a3cd2593a47.so --extern rustc_query_system=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_query_system-c0820170a4d74415.rmeta --extern rustc_serialize=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_serialize-983e836ae27a89c6.rmeta --extern rustc_session=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_session-460c56b3f5719dbd.rmeta --extern rustc_span=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_span-1dbb07394d590c27.rmeta --extern rustc_target=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_target-b01ab5104179568a.rmeta --extern smallvec=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libsmallvec-5b86fc59326ca1e7.rmeta --extern tracing=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libtracing-6132f0f4621eff27.rmeta -C target-cpu=native -Zmacro-backtrace '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Zunstable-options '-Wrustc::internal' -Cprefer-dynamic -Zbinary-dep-depinfo -L native=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/build/psm-fefe209cb5a48701/out` (exit code: 254)
warning: build failed, waiting for other jobs to finish...

In dmsg I could see this:

[336285.100146] rustc[2173805]: segfault at a5 ip 00007f845ed6e310 sp 00007f844bffc200 error 4 in libLLVM-11-rust-dev.so[7f845eb90000+20ce000]
[336285.100157] Code: 24 20 85 c9 74 04 48 89 0c 08 4c 8b b4 24 98 00 00 00 4c 8b 44 24 18 45 8d 48 01 48 89 6c 24 48 48 8b 4c 24 28 48 89 4c 24 50 <49> 8b 42 10 48 8b 10 48 85 c9 74 2f 48 6b f1 38 31 ff 31 c0 66 2e
[336285.100212] audit: type=1701 audit(1598967540.990:822): auid=1000 uid=1000 gid=1000 ses=2 pid=2173044 comm="rustc" exe="/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" sig=11 res=1

I did a bisect and found out that the crash happens since 1d22f75
cc @davidtwco

my cpu is a Intel(R) Core(TM) i5-7200U CPU

The timing of the crash makes me think that this might happen somewhere during LTOing of the rustc_middle crate, rustc did not show a backtrace for the crash though, since it happens inside llvm.
I already did purge my rustc build cache and the sccache before I saw the segfault happens inside llvm (it didn't help anyway). 😅

rustc @ d9cd4a3

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions