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

llvm segfaults during bootstrap of rustc_middle in stage 1 #76213

Closed
matthiaskrgr opened this issue Sep 1, 2020 · 15 comments · Fixed by #80122
Closed

llvm segfaults during bootstrap of rustc_middle in stage 1 #76213

matthiaskrgr opened this issue Sep 1, 2020 · 15 comments · Fixed by #80122
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

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

@matthiaskrgr matthiaskrgr added the C-bug Category: This is a bug. label Sep 1, 2020
@davidtwco
Copy link
Member

cc @eddyb

@jonas-schievink jonas-schievink added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. I-prioritize Issue: Indicates that prioritization has been requested for this issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. labels Sep 1, 2020
@Aaron1011
Copy link
Member

@matthiaskrgr: Was a coredump generated? If so, should be able to generate a backtrace by running gdb corefile, followed by the bt command.

@matthiaskrgr
Copy link
Member Author

[New LWP 2248402]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
0x00007fbaf234a9b7 in __pthread_clockjoin_ex () from /usr/lib/libpthread.so.0
(gdb) continue
Continuing.
[New Thread 0x7fbae514e640 (LWP 2248426)]
[New Thread 0x7fbae4b18640 (LWP 2248427)]
[New Thread 0x7fbae4225640 (LWP 2248432)]
[New Thread 0x7fbaddffe640 (LWP 2248438)]
[New Thread 0x7fbaddffe640 (LWP 2248474)]
[Thread 0x7fbaddffe640 (LWP 2248438) exited]
[New Thread 0x7fbaf17fd640 (LWP 2248491)]
[Thread 0x7fbae4225640 (LWP 2248432) exited]
[Thread 0x7fbaddffe640 (LWP 2248474) exited]
[Thread 0x7fbaf17fd640 (LWP 2248491) exited]
[New Thread 0x7fbaf17fd640 (LWP 2248499)]
[New Thread 0x7fbaddffe640 (LWP 2248500)]

Thread 9 "rustc" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fbaf17fd640 (LWP 2248499)]
0x00007fbaf343c310 in llvm::CallInst::Create(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, llvm::Twine const&, llvm::Instruction*) () from /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM-11-rust-dev.so
(gdb) bt
#0  0x00007fbaf343c310 in llvm::CallInst::Create(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, llvm::Twine const&, llvm::Instruction*) () from /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM-11-rust-dev.so
#1  0x00007fbaf343bf11 in llvm::IRBuilderBase::CreateCall(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::Twine const&, llvm::MDNode*) ()
   from /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM-11-rust-dev.so
#2  0x00007fbaf350121d in llvm::IRBuilderBase::CreateMaskedGather(llvm::Value*, llvm::Align, llvm::Value*, llvm::Value*, llvm::Twine const&) ()
   from /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM-11-rust-dev.so
#3  0x00007fbaf45f9aeb in llvm::InnerLoopVectorizer::vectorizeMemoryInstruction(llvm::Instruction*, llvm::VPTransformState&, llvm::VPValue*, llvm::VPValue*, llvm::VPValue*) ()
   from /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM-11-rust-dev.so
#4  0x00007fbaf466bdb4 in llvm::VPBasicBlock::execute(llvm::VPTransformState*) () from /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM-11-rust-dev.so
#5  0x00007fbaf466d23d in llvm::VPlan::execute(llvm::VPTransformState*) () from /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM-11-rust-dev.so
#6  0x00007fbaf461a9ee in llvm::LoopVectorizationPlanner::executePlan(llvm::InnerLoopVectorizer&, llvm::DominatorTree*) ()
   from /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM-11-rust-dev.so
#7  0x00007fbaf46256e8 in llvm::LoopVectorizePass::processLoop(llvm::Loop*) () from /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM-11-rust-dev.so
#8  0x00007fbaf4627237 in llvm::LoopVectorizePass::runImpl(llvm::Function&, llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::TargetTransformInfo&, llvm::DominatorTree&, llvm::BlockFrequencyInfo&, llvm::TargetLibraryInfo*, llvm::DemandedBits&, llvm::AAResults&, llvm::AssumptionCache&, std::function<llvm::LoopAccessInfo const& (llvm::Loop&)>&, llvm::OptimizationRemarkEmitter&, llvm::ProfileSummaryInfo*) () from /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM-11-rust-dev.so
#9  0x00007fbaf462acab in (anonymous namespace)::LoopVectorize::runOnFunction(llvm::Function&) () from /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM-11-rust-dev.so
#10 0x00007fbaf353d3b2 in llvm::FPPassManager::runOnFunction(llvm::Function&) () from /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM-11-rust-dev.so
#11 0x00007fbaf3544023 in llvm::FPPassManager::runOnModule(llvm::Module&) () from /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM-11-rust-dev.so
#12 0x00007fbaf353ddfa in llvm::legacy::PassManagerImpl::run(llvm::Module&) () from /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM-11-rust-dev.so
#13 0x00007fbaf34a08fa in LLVMRunPassManager () from /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM-11-rust-dev.so
#14 0x00007fbaf6db4054 in rustc_codegen_llvm::back::lto::run_pass_manager () from /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-1c5da71f0b2b75c2.so
#15 0x00007fbaf6dff3ef in <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::write::WriteBackendMethods>::optimize_thin ()
   from /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-1c5da71f0b2b75c2.so
#16 0x00007fbaf6bffbf0 in rustc_codegen_ssa::back::lto::LtoModuleCodegen<B>::optimize ()
   from /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-1c5da71f0b2b75c2.so
#17 0x00007fbaf6d44d77 in rustc_codegen_ssa::back::write::execute_work_item () from /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-1c5da71f0b2b75c2.so
#18 0x00007fbaf6c6953e in std::sys_common::backtrace::__rust_begin_short_backtrace () from /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-1c5da71f0b2b75c2.so
#19 0x00007fbaf6c732d7 in core::ops::function::FnOnce::call_once{{vtable-shim}} () from /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-1c5da71f0b2b75c2.so
#20 0x00007fbaf57c3cc8 in std::sys::unix::thread::Thread::new::thread_start () from /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage1/lib/libstd-a52de4cbb300e5a7.so
#21 0x00007fbaf23493e9 in start_thread () from /usr/lib/libpthread.so.0
#22 0x00007fbaf55d1293 in clone () from /usr/lib/libc.so.6

does this help?

@matthiaskrgr
Copy link
Member Author

config.toml via cat config.toml | grep -v "^\#" | grep "."

[llvm]
thin-lto = true
ninja = true
targets = "X86"
link-jobs = 2
[build]
extended = true
tools = ["cargo", "rls", "clippy", "rustfmt", "analysis", "src", "miri", "rust-analyzer"]
sanitizers = true
profiler = true
low-priority = true
[install]
[rust]
codegen-units = 0
backtrace-on-ice = true
[target.x86_64-unknown-linux-gnu]
ar = "llvm-ar"
ranlib = "llvm-ranlib"
[dist]

@matthiaskrgr
Copy link
Member Author

There is no segfault if I build without -Ctarget-cpu=native

@Dylan-DPC-zz
Copy link

Marking this as P-high based on the wg-prioritization discussion

@Dylan-DPC-zz Dylan-DPC-zz added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Sep 11, 2020
@Aaron1011
Copy link
Member

@matthiaskrgr: What setup are you using to pass -Ctarget-cpu=native?

@matthiaskrgr
Copy link
Member Author

matthiaskrgr commented Sep 11, 2020

I had export RUSTFLAGS="-C target-cpu=native" in my ~/.zsh.rs initially.

RUSTFLAGS="-Ctarget-cpu=native" ./x.py build reproduces the segfault as well.

@Mark-Simulacrum
Copy link
Member

@petrochenkov was hitting segfaults with LLD with target-cpu=native, but that was on MSVC: #76398

@matthiaskrgr
Copy link
Member Author

Hmm, I think i also have my linker set to lld, but I'm on linux...

@matthiaskrgr
Copy link
Member Author

Still crashes after llvm update in #77063

@12101111
Copy link
Contributor

I got the same SIGSEGV with RUSTFLAGS=-Ctarget-cpu=skylake at stage 0

Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage0 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling cfg-if v0.1.10
........
   Compiling rustc_interface v0.0.0 (/home/han/rust/compiler/rustc_interface)
rustc exited with signal: 11
error: could not compile `rustc_middle`

Caused by:
  process didn't exit successfully: `/home/han/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 -C embed-bitcode=no -C debuginfo=0 -C metadata=08bb84f699551128 -C extra-filename=-08bb84f699551128 --out-dir /home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -C linker=clang -L dependency=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps --extern bitflags=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libbitflags-4cf3d26892fd44c6.rmeta --extern chalk_ir=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libchalk_ir-5422cc95e5349c6c.rmeta --extern measureme=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libmeasureme-7c384b048410572e.rmeta --extern polonius_engine=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libpolonius_engine-58a145a1c9e28eda.rmeta --extern rustc_rayon_core=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_rayon_core-22e5ea716efef0de.rmeta --extern rustc_apfloat=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_apfloat-bfd634f63331afc4.rmeta --extern rustc_arena=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_arena-3c3caccfe6ba3474.rmeta --extern rustc_ast=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_ast-4936433b2ff91d56.rmeta --extern rustc_attr=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_attr-811ead840a1bc164.rmeta --extern rustc_data_structures=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-e4e266d92872a222.rmeta --extern rustc_errors=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-d4b3e2b0c68866d7.rmeta --extern rustc_feature=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_feature-5aea8b2754c1c93b.rmeta --extern rustc_hir=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_hir-43d249f142ba2a26.rmeta --extern rustc_index=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_index-8c7dba2e082a7314.rmeta --extern rustc_macros=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps/librustc_macros-7c6fe122673a7124.so --extern rustc_query_system=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_query_system-cae42633e89bcbe6.rmeta --extern rustc_serialize=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_serialize-90380c6cae6d30dd.rmeta --extern rustc_session=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_session-5892855e836cf78c.rmeta --extern rustc_span=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_span-d1b8a59d2f3d5646.rmeta --extern rustc_target=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_target-33a877fc28017892.rmeta --extern smallvec=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsmallvec-55080a350dd708e2.rmeta --extern tracing=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libtracing-193155a17a030180.rmeta -Ctarget-cpu=skylake --cfg=bootstrap -Zmacro-backtrace '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Zunstable-options '-Wrustc::internal' -Cprefer-dynamic -Z binary-dep-depinfo -L native=/home/han/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/psm-20ef5d798efbb0a8/out` (exit code: 254)
command did not execute successfully: "/home/han/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "12" "--release" "--features" " llvm max_level_info" "--manifest-path" "/home/han/rust/compiler/rustc/Cargo.toml" "--message-format" "json-render-diagnostics"
expected success, got: exit code: 101
failed to run: /home/han/rust/build/bootstrap/debug/bootstrap build --stage 2
Build completed unsuccessfully in 0:10:28
* thread #1, name = 'rustc', stop reason = signal SIGSEGV
  * frame #0: 0x00007f9be89cd300 libLLVM-11-rust-1.48.0-beta.so`llvm::CallInst::Create(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, llvm::Twine const&, llvm::Instruction*) + 512
    frame #1: 0x00007f9be89ccf11 libLLVM-11-rust-1.48.0-beta.so`llvm::IRBuilderBase::CreateCall(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::Twine const&, llvm::MDNode*) + 65
    frame #2: 0x00007f9be8a8f68d libLLVM-11-rust-1.48.0-beta.so`llvm::IRBuilderBase::CreateMaskedGather(llvm::Value*, llvm::Align, llvm::Value*, llvm::Value*, llvm::Twine const&) + 477
    frame #3: 0x00007f9be9b459d6 libLLVM-11-rust-1.48.0-beta.so`llvm::InnerLoopVectorizer::vectorizeMemoryInstruction(llvm::Instruction*, llvm::VPTransformState&, llvm::VPValue*, llvm::VPValue*, llvm::VPValue*) + 1158
    frame #4: 0x00007f9be9bb5204 libLLVM-11-rust-1.48.0-beta.so`llvm::VPBasicBlock::execute(llvm::VPTransformState*) + 836
    frame #5: 0x00007f9be9bb667d libLLVM-11-rust-1.48.0-beta.so`llvm::VPlan::execute(llvm::VPTransformState*) + 2237
    frame #6: 0x00007f9be9b65f8e libLLVM-11-rust-1.48.0-beta.so`llvm::LoopVectorizationPlanner::executePlan(llvm::InnerLoopVectorizer&, llvm::DominatorTree*) + 334
    frame #7: 0x00007f9be9b70874 libLLVM-11-rust-1.48.0-beta.so`llvm::LoopVectorizePass::processLoop(llvm::Loop*) + 11716
    frame #8: 0x00007f9be9b723d7 libLLVM-11-rust-1.48.0-beta.so`llvm::LoopVectorizePass::runImpl(llvm::Function&, llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::TargetTransformInfo&, llvm::DominatorTree&, llvm::BlockFrequencyInfo&, llvm::TargetLibraryInfo*, llvm::DemandedBits&, llvm::AAResults&, llvm::AssumptionCache&, std::function<llvm::LoopAccessInfo const& (llvm::Loop&)>&, llvm::OptimizationRemarkEmitter&, llvm::ProfileSummaryInfo*) + 439
    frame #9: 0x00007f9be9b75d5b libLLVM-11-rust-1.48.0-beta.so`(anonymous namespace)::LoopVectorize::runOnFunction(llvm::Function&) + 1259
    frame #10: 0x00007f9be8acac92 libLLVM-11-rust-1.48.0-beta.so`llvm::FPPassManager::runOnFunction(llvm::Function&) + 1618
    frame #11: 0x00007f9be8ad16a3 libLLVM-11-rust-1.48.0-beta.so`llvm::FPPassManager::runOnModule(llvm::Module&) + 51
    frame #12: 0x00007f9be8acb6ea libLLVM-11-rust-1.48.0-beta.so`llvm::legacy::PassManagerImpl::run(llvm::Module&) + 1706
    frame #13: 0x00007f9be8a303da libLLVM-11-rust-1.48.0-beta.so`LLVMRunPassManager + 10
    frame #14: 0x00007f9bec682ce8 librustc_driver-86d063075abfdc3d.so`rustc_codegen_llvm::back::lto::run_pass_manager::hc805cd36044a617c + 376
    frame #15: 0x00007f9bec683ec5 librustc_driver-86d063075abfdc3d.so`rustc_codegen_llvm::back::lto::optimize_thin_module::h9ceb634323daefb4 + 4213
    frame #16: 0x00007f9bec580dec librustc_driver-86d063075abfdc3d.so`rustc_codegen_ssa::back::lto::LtoModuleCodegen$LT$B$GT$::optimize::hb29e670d2902853d + 28
    frame #17: 0x00007f9bec620512 librustc_driver-86d063075abfdc3d.so`rustc_codegen_ssa::back::write::execute_work_item::h5473850dfe6a4f4c + 178
    frame #18: 0x00007f9bec4f953f librustc_driver-86d063075abfdc3d.so`std::sys_common::backtrace::__rust_begin_short_backtrace::h61b3b1a30fd25593 + 207
    frame #19: 0x00007f9bec584865 librustc_driver-86d063075abfdc3d.so`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::had7609c900926f17 + 101
    frame #20: 0x00007f9beb91970a libstd-3532beb752f910d7.so`std::sys::unix::thread::Thread::new::thread_start::h33c6d7cf25f9291f [inlined] _$LT$alloc..boxed..Box$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$A$GT$$GT$::call_once::hd4d30e37db281e8f at boxed.rs:1042:9
    frame #21: 0x00007f9beb919704 libstd-3532beb752f910d7.so`std::sys::unix::thread::Thread::new::thread_start::h33c6d7cf25f9291f [inlined] _$LT$alloc..boxed..Box$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$A$GT$$GT$::call_once::h019185a215ba16e4 at boxed.rs:1042
    frame #22: 0x00007f9beb9196fb libstd-3532beb752f910d7.so`std::sys::unix::thread::Thread::new::thread_start::h33c6d7cf25f9291f at thread.rs:87
    frame #23: 0x00007f9beb831f9e libpthread.so.0`start_thread + 222
    frame #24: 0x00007f9beb76065f libc.so.6`__clone + 63

config.toml:

[llvm]
link-shared = true
[build]
[install]
[rust]
[target.x86_64-unknown-linux-gnu]
cc = "clang"
cxx = "clang++"
ar = "/usr/lib/llvm/11/bin/llvm-ar"
ranlib = "/usr/lib/llvm/11/bin/llvm-ranlib"
linker = "clang"
llvm-config = "/usr/lib/llvm/11/bin/llvm-config"
[dist]

Can't reproduce it with bootstrap from 1.47 to 1.47

@gyakovlev
Copy link

some users hit it in gentoo with 1.48.0
downstream bug https://bugs.gentoo.org/756340

removing -Ctarget-cpu=skylake or -Ctarget-cpu=native helps as described here.

@spastorino
Copy link
Member

@bors bors closed this as completed in 1954756 Dec 18, 2020
@geometryolife
Copy link
Contributor

I ran into the same problem:
OS: Ubuntu20.04

rustc exited with signal: 9
error: could not compile rustc_middle

Caused by:������������������������������� process didn't exit successfully: /home/Joe/prog/rust2/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 -C embed-bitcode=no -C debuginfo=0 -C metadata=268a3ef6c55803d4 -C extra-filename=-268a3ef6c55803d4 --out-dir /home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps --extern bitflags=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libbitflags-d1f52e73a3f23280.rmeta --extern chalk_ir=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libchalk_ir-b78c1f26170ae349.rmeta --extern measureme=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libmeasureme-e24f83431d71776d.rmeta --extern polonius_engine=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libpolonius_engine-6575cb23f11d3a1b.rmeta --extern rustc_rayon_core=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_rayon_core-90051683359cce3d.rmeta --extern rustc_apfloat=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_apfloat-73664e2a056a0287.rmeta --extern rustc_arena=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_arena-227cf6d16219da78.rmeta --extern rustc_ast=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_ast-387fb9a1fbcb85c1.rmeta --extern rustc_attr=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_attr-70b86ed597034a97.rmeta --extern rustc_data_structures=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-64cd85fd61960c1e.rmeta --extern rustc_errors=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-da21d0456f0fbfc9.rmeta --extern rustc_feature=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_feature-02c2de30568fa960.rmeta --extern rustc_hir=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_hir-57008f3053b15a87.rmeta --extern rustc_index=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_index-de4406c76b069506.rmeta --extern rustc_macros=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps/librustc_macros-e96df6e8e344825b.so --extern rustc_query_system=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_query_system-e277546ced20eb1c.rmeta --extern rustc_serialize=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_serialize-401b0d489cdb0355.rmeta --extern rustc_session=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_session-c2475b4eb2953980.rmeta --extern rustc_span=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_span-de0edc7ae784e6a7.rmeta --extern rustc_target=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_target-43561a0ffc696f45.rmeta --extern rustc_type_ir=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_type_ir-68eca905cfec010c.rmeta --extern smallvec=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsmallvec-f3fee2d091099577.rmeta --extern tracing=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libtracing-aad7cba3f2e430ad.rmeta --cfg=bootstrap -Zmacro-backtrace '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Ztls-model=initial-exec -Zunstable-options '-Wrustc::internal' -Cprefer-dynamic -Z binary-dep-depinfo -L native=/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/psm-ddf1ab9f13b53adf/out (exit code: 254)
command did not execute successfully: "/home/Joe/prog/rust2/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "1" "--release" "--features" " llvm max_level_info" "--manifest-path" "/home/Joe/prog/rust2/compiler/rustc/Cargo.toml" "--message-format" "json-render-diagnostics"

expected success, got: exit code: 101
failed to run: /home/Joe/prog/rust2/build/bootstrap/debug/bootstrap build
Build completed unsuccessfully in 4:59:39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. P-high High priority 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.