Skip to content

LTO segfaults in llvm #32272

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
MagaTailor opened this issue Mar 15, 2016 · 19 comments
Closed

LTO segfaults in llvm #32272

MagaTailor opened this issue Mar 15, 2016 · 19 comments
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.

Comments

@MagaTailor
Copy link

With LTO enabled, using rustc 1.9.0-dev (1a019dc86 2016-03-11) on ARM, leads to a segfault in llvm:

gdb --args rustc parity/main.rs --crate-name parity --crate-type bin -C opt-level=3 -C lto --cfg feature=\"default\" --cfg feature=\"rpc\" --cfg feature=\"ethcore-rpc\" --out-dir /parity-master/target/release --emit=dep-info,link -L dependency=/parity-master/target/release -L dependency=/parity-master/target/release/deps --extern number_prefix=/parity-master/target/release/deps/libnumber_prefix-79886f004b9e099f.rlib --extern time=/parity-master/target/release/deps/libtime-78927599ef4c022b.rlib --extern ethcore_devtools=/parity-master/target/release/deps/libethcore_devtools-355c9d1ce0259a79.rlib --extern docopt=/parity-master/target/release/deps/libdocopt-3f1c0f9fd1bf4032.rlib --extern fdlimit=/parity-master/target/release/deps/libfdlimit-6385d001b4486604.rlib --extern log=/parity-master/target/release/deps/liblog-659d4388b7b05ff7.rlib --extern ethcore_rpc=/parity-master/target/release/deps/libethcore_rpc-a8be65bc1cfc0bb1.rlib --extern ethsync=/parity-master/target/release/deps/libethsync-34b8e56f1ab0d84e.rlib --extern rustc_serialize=/parity-master/target/release/deps/librustc_serialize-1ef07a8e16df0706.rlib --extern daemonize=/parity-master/target/release/deps/libdaemonize-86dcb9667bdf6652.rlib --extern rpassword=/parity-master/target/release/deps/librpassword-1b41f4e45c6c82f7.rlib --extern ctrlc=/parity-master/target/release/deps/libctrlc-c47f25746b88525b.rlib --extern ethcore_util=/parity-master/target/release/deps/libethcore_util-768aab1a12414a14.rlib --extern ethcore=/parity-master/target/release/deps/libethcore-76e1745e5ee2119f.rlib --extern ethminer=/parity-master/target/release/deps/libethminer-ed103fb72dcfe84a.rlib --extern env_logger=/parity-master/target/release/deps/libenv_logger-39002267300f4443.rlib -L native=/parity-master/target/release/build/sha3-852cf4d9ea9f3e73/out -L native=/parity-master/target/release/build/rust-crypto-a5c15010484ab93b/out -L native=/parity-master/target/release/build/librocksdb-sys-d6ed37f49ed8bf2a/out/lib -L native=/parity-master/target/release/build/eth-secp256k1-67c0faf4bfdaa4d4/out
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb2ea72a0 (LWP 32136)]
0xb4360cc0 in llvm::BasicAAResult::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&) ()
   from /rust/bin/../lib/librustc_llvm-9026086f.so
(gdb) bt
#0  0xb4360cc0 in llvm::BasicAAResult::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&) ()
   from /rust/bin/../lib/librustc_llvm-9026086f.so
#1  0xb433ff2c in llvm::AAResults::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&) ()
   from /rust/bin/../lib/librustc_llvm-9026086f.so
#2  0xb443c150 in llvm::MemoryDependenceAnalysis::getSimplePointerDependencyFrom(llvm::MemoryLocation const&, bool, llvm::ilist_iterator<llvm::Instruction>, llvm::BasicBlock*, llvm::Instruction*) ()
   from /rust/bin/../lib/librustc_llvm-9026086f.so
#3  0xb443c220 in llvm::MemoryDependenceAnalysis::getPointerDependencyFrom(llvm::MemoryLocation const&, bool, llvm::ilist_iterator<llvm::Instruction>, llvm::BasicBlock*, llvm::Instruction*) ()
   from /rust/bin/../lib/librustc_llvm-9026086f.so
#4  0xb443fe80 in llvm::MemoryDependenceAnalysis::GetNonLocalInfoForBlock(llvm::Instruction*, llvm::MemoryLocation const&, bool, llvm::BasicBlock*, std::vector<llvm::NonLocalDepEntry, std::allocator<llvm::NonLocalDepEntry> >*, unsigned int) ()
   from /rust/bin/../lib/librustc_llvm-9026086f.so
#5  0xb4443018 in llvm::MemoryDependenceAnalysis::getNonLocalPointerDepFromBB(llvm::Instruction*, llvm::PHITransAddr const&, llvm::MemoryLocation const&, bool, llvm::BasicBlock*, llvm::SmallVectorImpl<llvm::NonLocalDepResult>&, llvm::DenseMap<llvm::BasicBlock*, llvm::Value*, llvm::DenseMapInfo<llvm::BasicBlock*>, llvm::detail::DenseMapPair<llvm::BasicBlock*, llvm::Value*> >&, bool) ()
   from /rust/bin/../lib/librustc_llvm-9026086f.so
#6  0xb4444b88 in llvm::MemoryDependenceAnalysis::getNonLocalPointerDependency(llvm::Instruction*, llvm::SmallVectorImpl<llvm::NonLocalDepResult>&) () from /rust/bin/../lib/librustc_llvm-9026086f.so
#7  0xb4045318 in (anonymous namespace)::GVN::processNonLocalLoad(llvm::LoadInst*) ()
   from /rust/bin/../lib/librustc_llvm-9026086f.so
#8  0xb4047658 in (anonymous namespace)::GVN::processInstruction(llvm::Instruction*) ()
   from /rust/bin/../lib/librustc_llvm-9026086f.so
#9  0xb4048f10 in (anonymous namespace)::GVN::runOnFunction(llvm::Function&) ()
   from /rust/bin/../lib/librustc_llvm-9026086f.so
#10 0xb4749a14 in llvm::FPPassManager::runOnFunction(llvm::Function&) ()
   from /rust/bin/../lib/librustc_llvm-9026086f.so
#11 0xb4749cd0 in llvm::legacy::PassManagerImpl::run(llvm::Module&) ()
   from /rust/bin/../lib/librustc_llvm-9026086f.so
#12 0xb464819c in LLVMRunPassManager () 
   from /rust/bin/../lib/librustc_llvm-9026086f.so
#13 0xb64ca818 in back::lto::run::h808941f87b30ef02Uzc ()
   from /rust/bin/../lib/librustc_trans-9026086f.so
#14 0xb64d4da8 in back::write::execute_work_item::h5f42fc708a2638a1NOd ()
   from /rust/bin/../lib/librustc_trans-9026086f.so
#15 0xb64cfe80 in back::write::run_passes::hfb1b468fd61a27acEAd ()
   from /rust/bin/../lib/librustc_trans-9026086f.so
#16 0xb6eb93c0 in driver::phase_5_run_llvm_passes::h0d65899dcc6974e772a ()
   from /rust/bin/../lib/librustc_driver-9026086f.so
#17 0xb6e8ffdc in driver::compile_input::h54981c39b9ca87cePca ()
   from /rust/bin/../lib/librustc_driver-9026086f.so
#18 0xb6e7df08 in run_compiler::h52667a7f69c30bb9lQc ()
   from /rust/bin/../lib/librustc_driver-9026086f.so
#19 0xb6e7b818 in sys_common::unwind::try::try_fn::h603405978117307818 () from /rust/bin/../lib/librustc_driver-9026086f.so
#20 0xb6bb5744 in sys_common::unwind::inner_try::h2b978c83a7e39f6dbuu () from /rust/bin/../lib/libstd-9026086f.so
#21 0xb6e7bff8 in boxed::F.FnBox$LT$A$GT$::call_box::h12017000814557942895 () from /rust/bin/../lib/librustc_driver-9026086f.so
#22 0xb6bd3570 in sys_common::thread::start_thread::hf54e8edfec0a0d71Cgu () from /rust/bin/../lib/libstd-9026086f.so
#23 0xb6bba020 in sys::thread::Thread::new::thread_start::hb5ad3f0368306661Kwz () from /rust/bin/../lib/libstd-9026086f.so
#24 0xb31c9fbc in start_thread (arg=0xb2ea72a0) at pthread_create.c:314
#25 0xb6a7d20c in ?? () at ../ports/sysdeps/unix/sysv/linux/arm/nptl/../clone.S:92 from /lib/arm-linux-gnueabihf/libc.so.6

or

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb2ea72a0 (LWP 32457)]
0xb43a39d4 in llvm::DemandedBits::performAnalysis() [clone .part.111] ()
   from /rust/bin/../lib/librustc_llvm-9026086f.so
(gdb) bt
#0  0xb43a39d4 in llvm::DemandedBits::performAnalysis() [clone .part.111] () from /rust/bin/../lib/librustc_llvm-9026086f.so
#1  0xb43a7784 in llvm::DemandedBits::isInstructionDead(llvm::Instruction*) () from /rust/bin/../lib/librustc_llvm-9026086f.so
#2  0xb4024a88 in (anonymous namespace)::BDCE::runOnFunction(llvm::Function&) [clone .part.25] () from /rust/bin/../lib/librustc_llvm-9026086f.so
#3  0xb4749a14 in llvm::FPPassManager::runOnFunction(llvm::Function&) () from /rust/bin/../lib/librustc_llvm-9026086f.so
#4  0xb4749cd0 in llvm::legacy::PassManagerImpl::run(llvm::Module&) () from /rust/bin/../lib/librustc_llvm-9026086f.so
#5  0xb464819c in LLVMRunPassManager () from /rust/bin/../lib/librustc_llvm-9026086f.so
#6  0xb64ca818 in back::lto::run::h808941f87b30ef02Uzc () from /rust/bin/../lib/librustc_trans-9026086f.so
#7  0xb64d4da8 in back::write::execute_work_item::h5f42fc708a2638a1NOd () from /rust/bin/../lib/librustc_trans-9026086f.so
#8  0xb64cfe80 in back::write::run_passes::hfb1b468fd61a27acEAd () from /rust/bin/../lib/librustc_trans-9026086f.so
#9  0xb6eb93c0 in driver::phase_5_run_llvm_passes::h0d65899dcc6974e772a () from /rust/bin/../lib/librustc_driver-9026086f.so
#10 0xb6e8ffdc in driver::compile_input::h54981c39b9ca87cePca () from /rust/bin/../lib/librustc_driver-9026086f.so
#11 0xb6e7df08 in run_compiler::h52667a7f69c30bb9lQc () from /rust/bin/../lib/librustc_driver-9026086f.so
#12 0xb6e7b818 in sys_common::unwind::try::try_fn::h603405978117307818 () from /rust/bin/../lib/librustc_driver-9026086f.so
#13 0xb6bb5744 in sys_common::unwind::inner_try::h2b978c83a7e39f6dbuu () from /rust/bin/../lib/libstd-9026086f.so
#14 0xb6e7bff8 in boxed::F.FnBox$LT$A$GT$::call_box::h12017000814557942895 () from /rust/bin/../lib/librustc_driver-9026086f.so
#15 0xb6bd3570 in sys_common::thread::start_thread::hf54e8edfec0a0d71Cgu () from /rust/bin/../lib/libstd-9026086f.so
#16 0xb6bba020 in sys::thread::Thread::new::thread_start::hb5ad3f0368306661Kwz () from /rust/bin/../lib/libstd-9026086f.so
#17 0xb31c9fbc in start_thread (arg=0xb2ea72a0) at pthread_create.c:314
#18 0xb6a7d20c in ?? () at ../ports/sysdeps/unix/sysv/linux/arm/nptl/../clone.S:92 from /lib/arm-linux-gnueabihf/libc.so.6

Even though the traces differ, the crash happens every time.
Interestingly, it doesn't reproduce on i686.

https://github.com/ethcore/parity/ , having enabled lto and opt-level=3 in Cargo.toml and used overrides for nix/mio

@sanxiyn sanxiyn added the A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. label Mar 16, 2016
@sanxiyn
Copy link
Member

sanxiyn commented Mar 16, 2016

How can I reproduce this? Parity(revision 5a96f99) fails to build for ARM for me because of a problem in a dependency.

$ multirust default nightly-2016-03-11
$ multirust add-target nightly-2016-03-11 arm-unknown-linux-gnueabihf
$ cargo build --target arm-unknown-linux-gnueabihf
nix-0.4.2/src/fcntl.rs:102:28: 102:41 error: mismatched types: expected `*const i8`, found `*const u8` [E0308]
nix-0.4.2/src/fcntl.rs:102 unsafe { ffi::open(cstr.as_ptr(), oflags.bits(), mode.bits() as mode_t }
                                              ^~~~~~~~~~~~~

@MagaTailor
Copy link
Author

Yep, the same old ARM breakage still bites - you need those nix/mio overrides I mentioned on the last line.
For example, after unpacking these:
https://github.com/nix-rust/nix/archive/master.zip
https://github.com/thkaw/mio/archive/v0.5.x.zip

to nix and mio in /tmp, add paths = ["/tmp/nix", "/tmp/mio"] to your .cargo/config

You'll have to build in release mode, too.

@sanxiyn
Copy link
Member

sanxiyn commented Mar 16, 2016

Do you have assertions enabled for LLVM?

@MagaTailor
Copy link
Author

Nah, I either build against system llvm or use a non-debug configuration for the occasional full build.

-original message-
Subject: Re: [rust] LTO segfaults in llvm (#32272)
From: Seo Sanghyeon [email protected]
Date: 16.03.2016 15:14

Do you have assertions enabled for LLVM?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#32272 (comment)

@sanxiyn
Copy link
Member

sanxiyn commented Mar 16, 2016

Differing tracebacks suggest data structure corruption, so it would be useful to have errors from assertion enabled LLVM.

@sanxiyn
Copy link
Member

sanxiyn commented Mar 16, 2016

I can't reproduce even with overrides. This is probably because I am cross-compiling, but you are building on ARM?

$ cargo rustc --release --target arm-unknown-linux-gnueabihf -- -C lto -C linker=arm-linux-gnueabihf-gcc
error: linking with `arm-linux-gnueabihf-gcc` failed: exit code: 1
note: /tmp/rustc.UWbdzurzi6jF/liblibrocksdb_sys-4bd5278da99c30b0.rlib: error adding symbols: File format not recognized

@MagaTailor
Copy link
Author

I was going to comment you were the first person to try cross-compiling parity and ask how the C++ part (rocksdb) went. Now we know :)

I think I'll do a full llvm build and try again tomorrow.

@MagaTailor
Copy link
Author

Clearly, this is a bad case of llvm miscompilation on ARM. (I've got custom CXXFLAGS in my environment which might be related)
With assertions on (and standard CXXFLAGS), I'm not even able to build rustc:

rustc: arm-unknown-linux-gnueabihf/stage1/lib/rustlib/arm-unknown-linux-gnueabihf/lib/libcore
rustc: rust-master/src/llvm/lib/IR/Attributes.cpp:876: llvm::AttributeSet llvm::AttributeSet::removeAttributes(llvm::LLVMContext&, unsigned int, llvm::AttributeSet) const: Assertion `!Attrs.hasAttribute(Index, Attribute::Alignment) && "Attempt to change alignment!"' failed.
Aborted

Before that, I'd done a quick build against system LLVM 3.6 and the resulting rustc was able to build parity just fine using LTO.

@MagaTailor
Copy link
Author

Ok, after much toil, I finally got this:

rustc: /rust-master/src/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:531: void {anonymous}::PromoteMem2Reg::run(): Assertion `isAllocaPromotable(AI) && "Cannot promote non-promotable alloca!"' failed.
(gdb) bt
#0  __libc_do_syscall () at ../ports/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:44
#1  0xb69b1f0e in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#2  0xb69b4766 in __GI_abort () at abort.c:89
#3  0xb69ad150 in __assert_fail_base (fmt=0x1 <error: Cannot access memory at address 0x1>, 
    assertion=0xb5d72c78 "isAllocaPromotable(AI) && \"Cannot promote non-promotable alloca!\"", assertion@entry=0x0, 
    file=0xb5d72b28 "/rust-master/src/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp", file@entry=0xb1f882b0 "\001", line=531, line@entry=3064397996, 
    function=function@entry=0xb5d6fe50 "void {anonymous}::PromoteMem2Reg::run()") at assert.c:92
#4  0xb69ad1e6 in __GI___assert_fail (assertion=0x0, file=0xb1f882b0 "\001", line=3064397996, 
    function=0xb5d6fe50 "void {anonymous}::PromoteMem2Reg::run()") at assert.c:101
#5  0xb4e45db0 in ?? () from /home/odroid/rust-nightly-sysalloc-assert/bin/../lib/librustc_llvm-9026086f.so

Was it the same assert triggered in that ARM cross-compilation issue? Yes it was:
#32049

@MagaTailor
Copy link
Author

Finally, a full debug build (rustc 1.9.0-dev (470ca1c3f 2016-04-07)) comes to the rescue:

rustc.bin: /src/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:531: void {anonymous}::PromoteMem2Reg::run(): Assertion `isAllocaPromotable(AI) && "Cannot promote non-promotable alloca!"' failed.

Program received signal SIGABRT, Aborted.
[Switching to Thread 0xb04bd2b0 (LWP 28697)]
__libc_do_syscall () at ../ports/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:44
44      ../ports/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S: No such file or directory.
(gdb) bt
#0  __libc_do_syscall () at ../ports/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:44
#1  0xb661bf0e in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#2  0xb661e766 in __GI_abort () at abort.c:89
#3  0xb6617150 in __assert_fail_base (fmt=0x1 <error: Cannot access memory at address 0x1>, assertion=0xb499aa18 "isAllocaPromotable(AI) && \"Cannot promote non-promotable alloca!\"", assertion@entry=0x0, 
    file=0xb499a8c8 "/src/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp", file@entry=0xb04bd2b0 "\001", line=531, 
    line@entry=3060637868, function=function@entry=0xb4997bf0 <(anonymous namespace)::PromoteMem2Reg::run()::__PRETTY_FUNCTION__> "void {anonymous}::PromoteMem2Reg::run()") at assert.c:92
#4  0xb66171e6 in __GI___assert_fail (assertion=0x0, file=0xb04bd2b0 "\001", line=3060637868, 
    function=0xb4997bf0 <(anonymous namespace)::PromoteMem2Reg::run()::__PRETTY_FUNCTION__> "void {anonymous}::PromoteMem2Reg::run()") at assert.c:101
#5  0xb3a6d8c0 in (anonymous namespace)::PromoteMem2Reg::run() () from rust/bin/../lib/librustc_llvm-9026086f.so
#6  0xb3a6db3c in llvm::PromoteMemToReg(llvm::ArrayRef<llvm::AllocaInst*>, llvm::DominatorTree&, llvm::AliasSetTracker*, llvm::AssumptionCache*) ()
   from rust/bin/../lib/librustc_llvm-9026086f.so
#7  0xb38af710 in llvm::SROA::promoteAllocas(llvm::Function&) () from rust/bin/../lib/librustc_llvm-9026086f.so
#8  0xb38c57d8 in llvm::SROA::runImpl(llvm::Function&, llvm::DominatorTree&, llvm::AssumptionCache&) () from rust/bin/../lib/librustc_llvm-9026086f.so
#9  0xb38c5eb8 in llvm::sroa::SROALegacyPass::runOnFunction(llvm::Function&) () from rust/bin/../lib/librustc_llvm-9026086f.so
#10 0xb3fa8bcc in llvm::FPPassManager::runOnFunction(llvm::Function&) () from rust/bin/../lib/librustc_llvm-9026086f.so
#11 0xb3b1195c in (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) () from rust/bin/../lib/librustc_llvm-9026086f.so
#12 0xb3fa93bc in llvm::legacy::PassManagerImpl::run(llvm::Module&) () from rust/bin/../lib/librustc_llvm-9026086f.so
#13 0xb3de0994 in LLVMRunPassManager () from rust/bin/../lib/librustc_llvm-9026086f.so
#14 0xb60adf38 in fnfn () at src/librustc_trans/back/lto.rs:163
#15 0xb60ada84 in rustc_trans::util::common::time<u32,closure> (do_it=false, what=..., f=...) at src/librustc/util/common.rs:38
#16 0xb60a74d4 in rustc_trans::back::lto::run (sess=0xb04baf10, llmod=0x965cae08, tm=0x96900018, reachable=..., config=0xb04b84e8, name_extra=..., output_names=0xb04b8488) at src/librustc_trans/back/lto.rs:162
#17 0xb60ca4a8 in fnfn () at src/librustc_trans/back/write.rs:504
#18 0xb60c9f44 in rustc_trans::util::common::time<(),closure> (do_it=false, what=..., f=...) at src/librustc/util/common.rs:38
#19 0xb60c73fc in rustc_trans::back::write::optimize_and_codegen (cgcx=0xb04b88a8, mtrans=..., config=..., name_extra=..., output_names=...) at src/librustc_trans/back/write.rs:503
#20 0xb60d10f4 in rustc_trans::back::write::execute_work_item (cgcx=0xb04b88a8, work_item=...) at src/librustc_trans/back/write.rs:875
#21 0xb60cfcd8 in rustc_trans::back::write::run_work_singlethreaded (sess=0xb04baf10, reachable=..., work_items=...) at src/librustc_trans/back/write.rs:888
#22 0xb60cc454 in rustc_trans::back::write::run_passes (sess=0xb04baf10, trans=0xb04b97a0, output_types=0xb04bb228, crate_output=0xb04b97e8) at src/librustc_trans/back/write.rs:712
#23 0xb6e8c418 in fnfn () at src/librustc_driver/driver.rs:981
#24 0xb6e8bf54 in rustc_driver::util::common::time<(),closure> (do_it=false, what=..., f=...) at src/librustc/util/common.rs:38
#25 0xb6cb6ec4 in rustc_driver::driver::phase_5_run_llvm_passes (sess=0xb04baf10, trans=0xb04b97a0, outputs=0xb04b97e8) at src/librustc_driver/driver.rs:979
#26 0xb6c008c0 in rustc_driver::driver::compile_input (sess=0xb04baf10, cstore=0xafb14bc8, cfg=..., input=0xb04bb6a8, outdir=0xb04bb794, output=0xb04bb788, addl_plugins=..., control=0xb04ba4ec)
    at src/librustc_driver/driver.rs:222
#27 0xb6be3e98 in rustc_driver::run_compiler (args=..., callbacks=...) at src/librustc_driver/lib.rs:213
#28 0xb6be07b8 in fnfn () at src/librustc_driver/lib.rs:132
#29 0xb6bde8d0 in fnfn () at src/librustc_driver/lib.rs:997
#30 0xb6bde3a8 in std::thread::Builder::spawn::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::h71e29f932f68a9c9 () at src/libstd/sys/common/mutex.rs:28
#31 0xb6bde340 in rustc_driver::sys_common::unwind::try::try_fn<closure> (opt_closure=0xb04bcb08 "") at src/libstd/sys/common/unwind/mod.rs:127
#32 0xb6857d6c in __rust_try () from rust/bin/../lib/libstd-9026086f.so
#33 0xb6857a54 in fnfn (s=0xb04bd7a8) at src/libstd/sys/common/unwind/mod.rs:148
#34 0xb6857950 in std::thread::local::{{impl}}::with<closure,core::result::Result<(), Box<Any>>> (self=0xb69bcab0 <std::panicking::PANIC_COUNT::hb97300d99929c675>, f=...) at src/libstd/thread/local.rs:211
#35 0xb6857858 in std::sys_common::unwind::inner_try (f=0xb6bde308 <rustc_driver::sys_common::unwind::try::try_fn<closure>>, data=0xb04bcb08 "") at src/libstd/sys/common/unwind/mod.rs:133
#36 0xb6bde2a8 in rustc_driver::sys_common::unwind::try<closure> (f=...) at src/libstd/sys/common/unwind/mod.rs:123
#37 0xb6bde154 in std::thread::Builder::spawn::_$u7b$$u7b$closure$u7d$$u7d$::h98fc4c71843fb136 () at src/libstd/sys/common/mutex.rs:28
#38 0xb6bdeba8 in rustc_driver::boxed::{{impl}}::call_box (self=0x7f571590, args=0) at src/liballoc/boxed.rs:541
#39 0xb6846a38 in std::boxed::{{impl}}::call_once (self=..., args=0) at src/liballoc/boxed.rs:550
#40 0xb6854fb8 in std::sys_common::thread::start_thread (main=0x7f571650) at src/libstd/sys/common/thread.rs:23
#41 0xb6892798 in std::sys::thread::{{impl}}::new::thread_start (main=0x7f571650) at src/libstd/sys/unix/thread.rs:74
#42 0xb07dafbc in start_thread (arg=0xb04bd2b0) at pthread_create.c:314
#43 0xb668920c in ?? () at ../ports/sysdeps/unix/sysv/linux/arm/nptl/../clone.S:92 from /lib/arm-linux-gnueabihf/libc.so.6

cc: @eddyb

@MagaTailor
Copy link
Author

MagaTailor commented May 8, 2016

I've just been able to complete this compilation for the first time with LTO enabled by using opt-level=z. That would suggest the highest level is currently broken on ARM in more than one way.

FWIW, unlike previously, at opt-level=3 rustc currently manages to print an error message before crashing:

Call parameter type does not match function signature!

@MagaTailor
Copy link
Author

MagaTailor commented Jun 10, 2016

@eddyb I've just confirmed MIR and/or this PR fixes this issue too (it was hitting the same assertion as that one.)

Is it any use keeping the issue open any longer? If old trans is not long for this world (and it still crashes the final stage, forgot to add) the chances of a fix are probably slim.

@eddyb
Copy link
Member

eddyb commented Jun 10, 2016

@petevine The alloca promotion crash from #32049 is fixed in both old trans and MIR trans, what are you seeing in the old trans case?

@MagaTailor
Copy link
Author

Still the same error: Call parameter type does not match function signature!

which, were I to use a debug build, should trigger the same assertion:

Assertion `isAllocaPromotable(AI) && "Cannot promote non-promotable alloca!"' failed.

@eddyb
Copy link
Member

eddyb commented Jun 10, 2016

@petevine That's a problem. Can you confirm the assertion can still be triggered in any way after #34141?

@MagaTailor
Copy link
Author

I definitely could but I'd prefer to use a full debug rustc build (and not just release+asserts llvm) to produce a good trace. Is an armv7 build like that available for download somewhere?

@eddyb
Copy link
Member

eddyb commented Jun 10, 2016

@petevine The backtrace is useless if it's the alloca assertion, because that happens during LLVM optimizations, which has a single entry point in rustc.
And no, debug builds for rustc are not available as they're ridiculously slow.

@MagaTailor
Copy link
Author

Yeah, I built one two months ago and not doing it again :) OK, the official builds have asserts enabled so I'll use one tomorrow and post the results.

@MagaTailor
Copy link
Author

MagaTailor commented Jun 11, 2016

@eddyb I've just finished using the toady's official nightly build and the issue seems to be gone. I may have mistakenly believed the 34505e222 revision, I'd used before, had already had the fix.

Using the very same build, the other issue does reproduce though.

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.
Projects
None yet
Development

No branches or pull requests

3 participants