Skip to content

segmentation fault for aarch64-unknown-none-softfloat on 0.1.38 #398

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

Closed
JohnTitor opened this issue Dec 19, 2020 · 3 comments · Fixed by #399
Closed

segmentation fault for aarch64-unknown-none-softfloat on 0.1.38 #398

JohnTitor opened this issue Dec 19, 2020 · 3 comments · Fixed by #399

Comments

@JohnTitor
Copy link
Member

Found in rust-lang/rust#79863 (comment):

rustc exited with signal: 11
error: could not compile `compiler_builtins`

Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --crate-name compiler_builtins /cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.38/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 codegen-units=10000 -C debuginfo=1 --cfg 'feature="c"' --cfg 'feature="cc"' --cfg 'feature="compiler-builtins"' --cfg 'feature="core"' --cfg 'feature="default"' --cfg 'feature="mem"' --cfg 'feature="rustc-dep-of-std"' -C metadata=11825feb351d960e -C extra-filename=-11825feb351d960e --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/aarch64-unknown-none-softfloat/release/deps --target aarch64-unknown-none-softfloat -C linker=aarch64-none-elf-gcc -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/aarch64-unknown-none-softfloat/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/release/deps --extern core=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/aarch64-unknown-none-softfloat/release/deps/librustc_std_workspace_core-7dd4080a03583e8c.rmeta --cap-lints allow -Zmacro-backtrace '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Cprefer-dynamic -Cembed-bitcode=yes -Z binary-dep-depinfo -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/aarch64-unknown-none-softfloat/release/build/compiler_builtins-cf9517a58eb87178/out --cfg 'feature="unstable"' --cfg 'feature="mem"' --cfg '__absvdi2="optimized-c"' --cfg '__absvsi2="optimized-c"' --cfg '__absvti2="optimized-c"' --cfg '__addvdi3="optimized-c"' --cfg '__addvsi3="optimized-c"' --cfg '__addvti3="optimized-c"' --cfg '__clzdi2="optimized-c"' --cfg '__clzsi2="optimized-c"' --cfg '__clzti2="optimized-c"' --cfg '__cmpdi2="optimized-c"' --cfg '__cmpti2="optimized-c"' --cfg '__comparetf2="optimized-c"' --cfg '__ctzdi2="optimized-c"' --cfg '__ctzsi2="optimized-c"' --cfg '__ctzti2="optimized-c"' --cfg '__divdc3="optimized-c"' --cfg '__divsc3="optimized-c"' --cfg '__divxc3="optimized-c"' --cfg '__extenddftf2="optimized-c"' --cfg '__extendhfsf2="optimized-c"' --cfg '__extendsftf2="optimized-c"' --cfg '__ffsti2="optimized-c"' --cfg '__fixtfdi="optimized-c"' --cfg '__fixtfsi="optimized-c"' --cfg '__fixtfti="optimized-c"' --cfg '__fixunstfdi="optimized-c"' --cfg '__fixunstfsi="optimized-c"' --cfg '__fixunstfti="optimized-c"' --cfg '__floatditf="optimized-c"' --cfg '__floatsitf="optimized-c"' --cfg '__floatunditf="optimized-c"' --cfg '__floatunsitf="optimized-c"' --cfg '__int_util="optimized-c"' --cfg '__muldc3="optimized-c"' --cfg '__mulsc3="optimized-c"' --cfg '__multc3="optimized-c"' --cfg '__mulvdi3="optimized-c"' --cfg '__mulvsi3="optimized-c"' --cfg '__mulvti3="optimized-c"' --cfg '__mulxc3="optimized-c"' --cfg '__negdf2="optimized-c"' --cfg '__negdi2="optimized-c"' --cfg '__negsf2="optimized-c"' --cfg '__negti2="optimized-c"' --cfg '__negvdi2="optimized-c"' --cfg '__negvsi2="optimized-c"' --cfg '__negvti2="optimized-c"' --cfg '__paritydi2="optimized-c"' --cfg '__paritysi2="optimized-c"' --cfg '__parityti2="optimized-c"' --cfg '__popcountdi2="optimized-c"' --cfg '__popcountsi2="optimized-c"' --cfg '__popcountti2="optimized-c"' --cfg '__powixf2="optimized-c"' --cfg '__subvdi3="optimized-c"' --cfg '__subvsi3="optimized-c"' --cfg '__subvti3="optimized-c"' --cfg '__truncdfhf2="optimized-c"' --cfg '__truncdfsf2="optimized-c"' --cfg '__truncsfhf2="optimized-c"' --cfg '__trunctfdf2="optimized-c"' --cfg '__trunctfsf2="optimized-c"' --cfg '__ucmpdi2="optimized-c"' --cfg '__ucmpti2="optimized-c"' --cfg 'apple_versioning="optimized-c"' -l static=compiler-rt` (exit code: 254)
warning: build failed, waiting for other jobs to finish...
[RUSTC-TIMING] alloc test:false 3.366
[RUSTC-TIMING] core test:false 19.307
error: build failed
command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "aarch64-unknown-none-softfloat" "-Zbinary-dep-depinfo" "-j" "16" "--release" "--locked" "--color" "always" "-p" "alloc" "--manifest-path" "/checkout/library/alloc/Cargo.toml" "--features" "compiler-builtins-mem compiler-builtins-c" "--message-format" "json-render-diagnostics"
expected success, got: exit code: 101
failed to run: /checkout/obj/build/bootstrap/debug/bootstrap dist --host= --target asmjs-unknown-emscripten,wasm32-unknown-emscripten,x86_64-rumprun-netbsd,mips-unknown-linux-musl,mipsel-unknown-linux-musl,mips64-unknown-linux-muslabi64,mips64el-unknown-linux-muslabi64,arm-unknown-linux-musleabi,arm-unknown-linux-musleabihf,armv5te-unknown-linux-gnueabi,armv5te-unknown-linux-musleabi,armv7-unknown-linux-musleabihf,aarch64-unknown-none,aarch64-unknown-none-softfloat,sparc64-unknown-linux-gnu,x86_64-unknown-redox,thumbv6m-none-eabi,thumbv7m-none-eabi,thumbv7em-none-eabi,thumbv7em-none-eabihf,thumbv8m.base-none-eabi,thumbv8m.main-none-eabi,thumbv8m.main-none-eabihf,riscv32i-unknown-none-elf,riscv32imc-unknown-none-elf,riscv32imac-unknown-none-elf,riscv64imac-unknown-none-elf,riscv64gc-unknown-none-elf,armebv7r-none-eabi,armebv7r-none-eabihf,armv7r-none-eabi,armv7r-none-eabihf,thumbv7neon-unknown-linux-gnueabihf,armv7a-none-eabi
Build completed unsuccessfully in 0:22:57

This was introduced between 0.1.36 and 0.1.38 but I have no idea what's the cause at all.

@bjorn3
Copy link
Member

bjorn3 commented Dec 19, 2020

Can you get a backtrace using a debugger?

@Amanieu
Copy link
Member

Amanieu commented Dec 21, 2020

Backtrace:

#0  0x00007fb65cb46631 in llvm::DAGTypeLegalizer::AnalyzeNewNode(llvm::SDNode*) () from /home/amanieu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-11-rust-1.50.0-nightly.so
#1  0x00007fb65cb47067 in llvm::DAGTypeLegalizer::AnalyzeNewValue(llvm::SDValue&) () from /home/amanieu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-11-rust-1.50.0-nightly.so
#2  0x00007fb65cb46a9f in llvm::DAGTypeLegalizer::ReplaceValueWith(llvm::SDValue, llvm::SDValue) () from /home/amanieu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-11-rust-1.50.0-nightly.so
#3  0x00007fb65cb2d00e in llvm::DAGTypeLegalizer::ExpandIntegerResult(llvm::SDNode*, unsigned int) () from /home/amanieu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-11-rust-1.50.0-nightly.so
#4  0x00007fb65cb4adfd in llvm::SelectionDAG::LegalizeTypes() () from /home/amanieu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-11-rust-1.50.0-nightly.so
#5  0x00007fb65cc6b7d4 in llvm::SelectionDAGISel::CodeGenAndEmitDAG() () from /home/amanieu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-11-rust-1.50.0-nightly.so
#6  0x00007fb65cc6ab77 in llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) () from /home/amanieu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-11-rust-1.50.0-nightly.so
#7  0x00007fb65cc67926 in llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) () from /home/amanieu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-11-rust-1.50.0-nightly.so
#8  0x00007fb65c7d078e in llvm::MachineFunctionPass::runOnFunction(llvm::Function&) () from /home/amanieu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-11-rust-1.50.0-nightly.so
#9  0x00007fb65c5aafd2 in llvm::FPPassManager::runOnFunction(llvm::Function&) () from /home/amanieu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-11-rust-1.50.0-nightly.so
#10 0x00007fb65c5b19e3 in llvm::FPPassManager::runOnModule(llvm::Module&) () from /home/amanieu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-11-rust-1.50.0-nightly.so
#11 0x00007fb65c5aba2a in llvm::legacy::PassManagerImpl::run(llvm::Module&) () from /home/amanieu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-11-rust-1.50.0-nightly.so
#12 0x00007fb66018ed50 in LLVMRustWriteOutputFile () from /home/amanieu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-4f0cc9f50e53f0ba.so
#13 0x00007fb6600cd77c in rustc_codegen_llvm::back::write::write_output_file () from /home/amanieu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-4f0cc9f50e53f0ba.so
#14 0x00007fb6600d1f9e in rustc_codegen_llvm::back::write::codegen () from /home/amanieu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-4f0cc9f50e53f0ba.so
#15 0x00007fb6600b3e2b in rustc_codegen_ssa::back::write::finish_intra_module_work () from /home/amanieu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-4f0cc9f50e53f0ba.so
#16 0x00007fb6600ae1a3 in rustc_codegen_ssa::back::write::execute_work_item () from /home/amanieu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-4f0cc9f50e53f0ba.so
#17 0x00007fb65ff9091f in std::sys_common::backtrace::__rust_begin_short_backtrace () from /home/amanieu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-4f0cc9f50e53f0ba.so
#18 0x00007fb65ff964ad in core::ops::function::FnOnce::call_once{{vtable-shim}} () from /home/amanieu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-4f0cc9f50e53f0ba.so
#19 0x00007fb65f42765a in alloc::boxed::{{impl}}::call_once<(),FnOnce<()>,alloc::alloc::Global> () at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/alloc/src/boxed.rs:1318
#20 alloc::boxed::{{impl}}::call_once<(),alloc::boxed::Box<FnOnce<()>, alloc::alloc::Global>,alloc::alloc::Global> () at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/alloc/src/boxed.rs:1318
#21 std::sys::unix::thread::{{impl}}::new::thread_start () at library/std/src/sys/unix/thread.rs:71
#22 0x00007fb65f3213e9 in start_thread () from /usr/lib/libpthread.so.0
#23 0x00007fb65f23c293 in clone () from /usr/lib/libc.so.6

Bisecting shows that this crash was introduced in b1a7a00.

To reproduce just:

rustup target add aarch64-unknown-none-softfloat
cargo build --target aarch64-unknown-none-softfloat

@AaronKutch
Copy link
Contributor

I wish somebody had pinged me earlier since this was the result of my changes. Here is a reduced example:

#![no_std]

pub fn u128_count_ones(x: u128) -> u32 {
    x.count_ones()
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants