LLVM 3.0 segfault compiling std.net.curl with -O3 -g #153

Closed
redstar opened this Issue Aug 11, 2012 · 5 comments

Comments

Projects
None yet
2 participants
@redstar
Owner

redstar commented Aug 11, 2012

I tried to build Phobos with optimization level 3 (-O3). I got the following segmentation fault:

[ 52%] Generating std/net/curl.o, std/net/curl.bc
cd /xtra/ldc && /xtra/ldc2_build/bin/ldc2 --output-o --output-bc -c -I/xtra/ldc/runtime/druntime/src -I/xtra/ldc/runtime/druntime/src/gc /xtra/ldc/runtime/phobos/std/net/curl.d -of/xtra/ldc2_build/runtime/std/net/curl.o -g -w -d -O3 -I/xtra/ldc/runtime/phobos

0  ldc2            0x000000000127ee0f
1  ldc2            0x000000000127f169
2  libpthread.so.0 0x00007f099d441b00
3  ldc2            0x000000000104089e llvm::DIDescriptor::getDescriptorField(unsigned int) const + 30
4  ldc2            0x0000000001041318 llvm::DIVariable::Verify() const + 24
5  ldc2            0x0000000000c948f3 llvm::DwarfDebug::beginFunction(llvm::MachineFunction const*) + 3347
6  ldc2            0x0000000000c82693 llvm::AsmPrinter::EmitFunctionHeader() + 611
7  ldc2            0x0000000000a6a1e8
8  ldc2            0x0000000001228d3f llvm::FPPassManager::runOnFunction(llvm::Function&) + 623
9  ldc2            0x0000000001228e2b llvm::FunctionPassManagerImpl::run(llvm::Function&) + 123
10 ldc2            0x0000000001228f96 llvm::FunctionPassManager::run(llvm::Function&) + 102
11 ldc2            0x00000000006440c2 emit_file(llvm::TargetMachine&, llvm::Module&, llvm::raw_fd_ostream&, llvm::TargetMachine::CodeGenFileType) + 546
12 ldc2            0x00000000006447ec writeModule(llvm::Module*, std::string) + 1292
13 ldc2            0x0000000000622fd3 main + 6707
14 libc.so.6       0x00007f099c6936c5 __libc_start_main + 245
15 ldc2            0x000000000063b03d
Stack dump:
0.  Running pass 'X86 AT&T-Style Assembly Printer' on function '@_D3std5regex23__T15ThompsonMatcherTaZ15ThompsonMatcher16__T8evalBackVb1Z8evalBackMFNePS3std5regex13__T6ThreadTmZ6ThreadAS3std5regex12__T5GroupTmZ5GroupZv'
/bin/sh: line 1: 20573 Segmentation fault      /xtra/ldc2_build/bin/ldc2 --output-o --output-bc -c -I/xtra/ldc/runtime/druntime/src -I/xtra/ldc/runtime/druntime/src/gc /xtra/ldc/runtime/phobos/std/net/curl.d -of/xtra/ldc2_build/runtime/std/net/curl.o -g -w -d -O3 -I/xtra/ldc/runtime/phobos
make[2]: *** [runtime/std/net/curl.o] Error 139
make[1]: *** [runtime/CMakeFiles/phobos-ldc.dir/all] Error 2
make: *** [all] Error 2

This happens only if I compiled LDC with LLVM 3.0. Maybe it's a LLVM 3.0 bug...

@klickverbot

This comment has been minimized.

Show comment Hide comment
@klickverbot

klickverbot Aug 11, 2012

Owner

Either that, or we are emitting invalid debug metadata in a way that isn't caught by the verifier (judging solely from the backtrace, that is).

Owner

klickverbot commented Aug 11, 2012

Either that, or we are emitting invalid debug metadata in a way that isn't caught by the verifier (judging solely from the backtrace, that is).

@redstar

This comment has been minimized.

Show comment Hide comment
@redstar

redstar Aug 11, 2012

Owner

BTW: This is independent of my commit 34d595d. The error occured before that.

Owner

redstar commented Aug 11, 2012

BTW: This is independent of my commit 34d595d. The error occured before that.

@redstar

This comment has been minimized.

Show comment Hide comment
@redstar

redstar Aug 11, 2012

Owner

You are right: The segmentation fault does not occur without the -g switch.

Owner

redstar commented Aug 11, 2012

You are right: The segmentation fault does not occur without the -g switch.

@klickverbot

This comment has been minimized.

Show comment Hide comment
@klickverbot

klickverbot Aug 12, 2012

Owner

Could also be that it's in fact an optimization pass misbehaving – I wouldn't expect -O3 -g to be a well tested combination for Clang, etc. either.

Owner

klickverbot commented Aug 12, 2012

Could also be that it's in fact an optimization pass misbehaving – I wouldn't expect -O3 -g to be a well tested combination for Clang, etc. either.

@klickverbot

This comment has been minimized.

Show comment Hide comment
@klickverbot

klickverbot Dec 19, 2012

Owner

Closing, as it is likely an LLVM 3.0 bug.

Owner

klickverbot commented Dec 19, 2012

Closing, as it is likely an LLVM 3.0 bug.

redstar pushed a commit that referenced this issue Sep 27, 2014

Merge pull request #153 from sandford/Issue_7523
Issue 7523 - Incorrect capacity for new T[] with non-zero T.init.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment