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

Compiling DCD with -singleobj causes segmentation fault #1275

Closed
HK47196 opened this issue Feb 1, 2016 · 9 comments
Closed

Compiling DCD with -singleobj causes segmentation fault #1275

HK47196 opened this issue Feb 1, 2016 · 9 comments

Comments

@HK47196
Copy link

HK47196 commented Feb 1, 2016

Hi,
When trying to compile DCD with the -singleobj flag turned on the compiler crashes with a segfault. I've tried my OS's LDC installation(0.16.1) and the latest beta release(0.17.0-beta2)
Backtrace:

ldc2 src/common/messages.d src/common/socket.d src/common/constants.d src/common/dcd_version.d src/client/client.d msgpack-d/src/msgpack.d -Imsgpack-d/src -Imsgpack-d/src -Icontainers/experimental_allocator/src -J=. -release -O5 -singleobj -of=bin/dcd-client
Error: #0 0x1afc270 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/bin/ldc+0x1afc270)
#1 0x1afb051 (/usr/bin/ldc+0x1afb051)
#2 0x7f7fbeaf0d60 __restore_rt (/usr/lib/libpthread.so.0+0x10d60)
#3 0x7f7fbd85062e _IO_vfprintf_internal (/usr/lib/libc.so.6+0x4862e)
#4 0x7f7fbd8792b9 _IO_vsnprintf (/usr/lib/libc.so.6+0x712b9)
#5 0x6973eb OutBuffer::vprintf(char const*, __va_list_tag*) (/usr/bin/ldc+0x6973eb)
#6 0x6fb496 verrorPrint(Loc, COLOR, char const*, char const*, __va_list_tag*, char const*, char const*) (/usr/bin/ldc+0x6fb496)
#7 0x6fb916 verror(Loc, char const*, __va_list_tag*, char const*, char const*, char const*) (/usr/bin/ldc+0x6fb916)
#8 0x6fb9d1 error(Loc, char const*, ...) (/usr/bin/ldc+0x6fb9d1)
#9 0x68a1e4 writeModule(llvm::Module*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (/usr/bin/ldc+0x68a1e4)
#10 0x681e90 ldc::CodeGenerator::writeAndFreeLLModule(char const*) (/usr/bin/ldc+0x681e90)
#11 0x63917e main (/usr/bin/ldc+0x63917e)
#12 0x7f7fbd828610 __libc_start_main (/usr/lib/libc.so.6+0x20610)
#13 0x67c0e9 _start (/usr/bin/ldc+0x67c0e9)

DCD makefile diff
diff.txt

full output text with -v -vv, warning it's 7.5MiB
log.txt

OS:
Linux x86_64, Arch Linux

@redstar
Copy link
Member

redstar commented Feb 1, 2016

The stack looks cool. Dieing while trying to print an error message?

@redstar
Copy link
Member

redstar commented Feb 1, 2016

Confirmed. Looks like #1272 fixes it but I am still investigating why.

@redstar
Copy link
Member

redstar commented Feb 2, 2016

Please, could you check if the problem is still present in master? Thanks.

@HK47196
Copy link
Author

HK47196 commented Feb 2, 2016

Built LDC from master, still get the same error when attempting to compile DCD with it.

@redstar
Copy link
Member

redstar commented Feb 2, 2016

Ok, let's see if I can still reproduce it.

@redstar
Copy link
Member

redstar commented Feb 2, 2016

The error message which the code tries to print is: "Error: cannot write object file: bin/dcd-server.o"
But yet no hint what is happening here.

@kinke
Copy link
Member

kinke commented Feb 2, 2016

error(Loc(), "cannot write object file: %s",
#if LDC_LLVM_VER >= 306
              errinfo
#else

but errinfo is no C string, it's a std::error_code...

It should be

        error(Loc(), "cannot write object file: %s",
#if LDC_LLVM_VER >= 306
              errinfo.message()
#else
              errinfo
#endif
              .c_str());

and not just here, but in other places (in the same function, maybe in others too) as well.
I'll prepare a PR.

@HK47196
Copy link
Author

HK47196 commented Feb 2, 2016

Woops, sorry for the wild goose chase. Looks like I just messed up the command line now that I get an error message due to #1277

Works fine now, thanks for the quick turn-around.

@kinke
Copy link
Member

kinke commented Feb 2, 2016

Looks like I just messed up the command line

Glad you did. These bugs aren't easy to come by. :)

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

No branches or pull requests

3 participants