Skip to content

Build with --enable-llvm-assertions segfaults on Windows (MinGW 64) #28445

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
petrochenkov opened this issue Sep 16, 2015 · 6 comments
Closed
Labels
O-windows Operating system: Windows

Comments

@petrochenkov
Copy link
Contributor

The issue is Windows-specific, I can't reproduce it on Kubuntu.
cc @alexcrichton (?) based on the backtrace and git blame

Configure:

./configure --enable-llvm-assertions

Build:

$ make VERBOSE=1
cfg: version 1.5.0-dev (355daea40 2015-09-16)
cfg: build triple x86_64-pc-windows-gnu
cfg: host triples x86_64-pc-windows-gnu
cfg: target triples x86_64-pc-windows-gnu
cfg: host for x86_64-pc-windows-gnu is x86_64
cfg: os for x86_64-pc-windows-gnu is pc-windows-gnu
cfg: good valgrind for x86_64-pc-windows-gnu is
cfg: using CC=gcc (CFG_CC)
cfg: disabling valgrind run-pass tests
MATCHES=""; if [ -n "$MATCHES" ] ; then echo "warning: removing previous" \'collections-*.dll\' "libraries:" $MATCHES; rm $MATCHES ; fi
MATCHES=""; if [ -n "$MATCHES" ] ; then echo "warning: removing previous" \'libcollections-*.rlib\' "libraries:" $MATCHES; rm $MATCHES ; fi
CFG_LLVM_LINKAGE_FILE=/home/we/rust/x86_64-pc-windows-gnu/rt/llvmdeps.rs PATH=/home/we/rust/x86_64-pc-windows-gnu/stage1/bin:$PATH   x86_64-pc-windows-gnu/stage1/bin/rustc.exe --cfg stage1  -O --cfg rtopt -C prefer-dynamic --target=x86_64-pc-windows-gnu  -D warnings -L "x86_64-pc-windows-gnu/rt" -L native="C:\msys64\home\we\rust\x86_64-pc-windows-gnu\llvm\Release+Asserts/lib"   -Z always-build-mir  --out-dir x86_64-pc-windows-gnu/stage1/bin/rustlib/x86_64-pc-windows-gnu/lib -C extra-filename=-bb943c5a src/libcollections/lib.rs
/home/we/rust/mk/target.mk:164: recipe for target 'x86_64-pc-windows-gnu/stage1/bin/rustlib/x86_64-pc-windows-gnu/lib/stamp.collections' failed
make: *** [x86_64-pc-windows-gnu/stage1/bin/rustlib/x86_64-pc-windows-gnu/lib/stamp.collections] Segmentation fault

gdb backtrace:

#0  0x00000000018937e2 in llvm::Value::setNameImpl(llvm::Twine const&) ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_llvm-bb943c5a.dll
#1  0x0000000001893b4d in llvm::Value::setName(llvm::Twine const&) ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_llvm-bb943c5a.dll
#2  0x0000000001ad986f in llvm::IRBuilder<true, llvm::TargetFolder, llvm::InstCombineIRInserter>::CreateBinOp(llvm::Instruction::BinaryOps, llvm::Value*, llvm::Value*, llvm::Twine const&, llvm::MDNode*) ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_llvm-bb943c5a.dll
#3  0x000000000142ccbe in llvm::InstCombiner::FoldShiftByConstant(llvm::Value*, llvm::Constant*, llvm::BinaryOperator&) ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_llvm-bb943c5a.dll
#4  0x000000000142dcfb in llvm::InstCombiner::commonShiftTransforms(llvm::BinaryOperator&) ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_llvm-bb943c5a.dll
#5  0x000000000142e245 in llvm::InstCombiner::visitShl(llvm::BinaryOperator&)
    ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_llvm-bb943c5a.dll
#6  0x000000000144bfd9 in llvm::InstCombiner::run() ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_llvm-bb943c5a.dll
#7  0x000000000144dbdf in combineInstructionsOverFunction(llvm::Function&, llvm::InstCombineWorklist&, llvm::AliasAnalysis*, llvm::AssumptionCache&, llvm::TargetLibraryInfo&, llvm::DominatorTree&, llvm::LoopInfo*) [clone .constprop.628]
    ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_llvm-bb943c5a.dll
#8  0x000000000144e51f in (anonymous namespace)::InstructionCombiningPass::runOnFunction(llvm::Function&) ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_llvm-bb943c5a.dll
#9  0x000000000186dbb3 in llvm::FPPassManager::runOnFunction(llvm::Function&)
    ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_llvm-bb943c5a.dll
#10 0x0000000001538ad1 in (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_llvm-bb943c5a.dll
#11 0x000000000186cf75 in llvm::legacy::PassManagerImpl::run(llvm::Module&) ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_llvm-bb943c5a.dll
#12 0x00000000017993ac in LLVMRunPassManager ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_llvm-bb943c5a.dll
#13 0x000000006d4e7b1a in back::write::execute_work_item::hee417ee5d2060ee7aZd
    ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_trans-bb943c5a.dll
#14 0x000000006d4e49e9 in back::write::run_passes::he502e7080e420917oKd ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_trans-bb943c5a.dll
#15 0x0000000070caab07 in driver::phase_5_run_llvm_passes::h56a4a26e3076deedYPa ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_driver-bb943c5a.dll
#16 0x0000000070c83909 in driver::compile_input::hc608c34987775d370ba ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_driver-bb943c5a.dll
#17 0x0000000070d4bd46 in run_compiler::h495ff227e8c31e61rqc ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_driver-bb943c5a.dll
#18 0x0000000070d49a00 in boxed::F.FnBox$LT$A$GT$::call_box::h14722094161447564838 ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_driver-bb943c5a.dll
#19 0x0000000070d49479 in sys_common::unwind::try::try_fn::h11281943328562696110 ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_driver-bb943c5a.dll
#20 0x00000000695ec97b in sys_common::unwind::try::inner_try::h55422f90cdac1927Dhs ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\std-bb943c5a.dll
#21 0x0000000070d49601 in boxed::F.FnBox$LT$A$GT$::call_box::h6396544982858683126 ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_driver-bb943c5a.dll
#22 0x00000000695ffa45 in sys::thread::Thread::new::thread_start::h43856871acbfe728qQw ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\std-bb943c5a.dll
#23 0x00007ffa0cb913d2 in KERNEL32!BaseThreadInitThunk ()
   from C:\Windows\system32\kernel32.dll
#24 0x00007ffa0db45454 in ntdll!RtlUserThreadStart ()
   from C:\Windows\SYSTEM32\ntdll.dll
#25 0x0000000000000000 in ?? ()
@alexcrichton
Copy link
Member

This... looks like a bug in LLVM? Or in gcc? There's not really much we can do here...

@petrochenkov
Copy link
Contributor Author

That's unfortunate, working on trans is pretty much impossible (at least for a newbie) without --enable-debug in general and --enable-llvm-assertions in particular.

I'll keep this issue open for status updates.

@steveklabnik steveklabnik added O-windows Operating system: Windows A-build labels Sep 28, 2015
@vadimcn
Copy link
Contributor

vadimcn commented Oct 11, 2015

Which version of GCC? This sounds similar to the one I saw: #28962

@petrochenkov
Copy link
Contributor Author

Yep, 5.2.0

@petrochenkov
Copy link
Contributor Author

Still reproduces with GCC 5.3

@petrochenkov
Copy link
Contributor Author

Fixed in GCC 6.2 which is officially available in MinGW-w64 now.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
O-windows Operating system: Windows
Projects
None yet
Development

No branches or pull requests

4 participants