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 3.0 segfault compiling std.net.curl with -O3 -g #153

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

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

redstar opened this issue Aug 11, 2012 · 5 comments
Labels

Comments

@redstar
Copy link
Member

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...

@dnadlinger
Copy link
Member

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
Copy link
Member Author

redstar commented Aug 11, 2012

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

@redstar
Copy link
Member Author

redstar commented Aug 11, 2012

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

@dnadlinger
Copy link
Member

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.

@dnadlinger
Copy link
Member

Closing, as it is likely an LLVM 3.0 bug.

redstar pushed a commit that referenced this issue Sep 27, 2014
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
Labels
Projects
None yet
Development

No branches or pull requests

2 participants