www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - Compiling using ldmd2 crashes, any ideas?

reply "Gary Willoughby" <dev nomad.so> writes:
I've used the installation guide here: 
http://wiki.dlang.org/Building_LDC_from_source

And when i compile using the different switches i get these 
errors:

---

rdmd --build-only --compiler=ldmd2 --force -m64 -property 
-release -w main.d

0  ldc2            0x00000000014a50a2 
llvm::sys::PrintStackTrace(_IO_FILE*) + 34
1  ldc2            0x00000000014a4e99
2  libpthread.so.0 0x00007f3ef263b030
3  ldc2            0x0000000000735242 AndAndExp::toElem(IRState*) 
+ 450
4  ldc2            0x000000000072e3ac 
Expression::toElemDtor(IRState*) + 540
5  ldc2            0x000000000071fa4b 
ExpStatement::toIR(IRState*) + 91
6  ldc2            0x000000000071f2e9 
CompoundStatement::toIR(IRState*) + 89
Error: Error executing /usr/local/bin/ldc2: Segmentation fault

---

rdmd --build-only --compiler=ldmd2 --force -m64 -property -w 
main.d

/tmp/.rdmd-1001/rdmd-main.d-2FB5FF642A0B7560CCCD18961A5DFC13/objs/main.o:(.rodata._D123TypeInfo_S3std8typecons86__T10RefCountedTS3std4file15DirIteratorImplVE3std8typecons24RefCountedAutoInitialize0Z10RefCounted6__initZ[_D123TypeInfo_S3std8typecons86__T10RefCountedTS3std4file15DirIteratorImplVE3std8typecons24RefCountedAutoInitialize0Z10RefCou
ted6__initZ]+0x60): 
undefined reference to 
`_D3std8typecons86__T10RefCountedTS3std4file15DirIteratorImplVE3std8typecons24RefCountedAutoInitialize0Z10RefCounted10__postblitMFZv'
collect2: error: ld returned 1 exit status
Error: /usr/bin/gcc failed with status: 1

---

If i add the -O compiler flag to the second example it compiles 
without error.

Any ideas what could be the problem? I haven't tried the ldc2 
executable because i need rdmd to correctly gather the 
dependencies.
Oct 10 2013
next sibling parent reply "Kai Nacke" <kai redstar.de> writes:
On Thursday, 10 October 2013 at 11:39:20 UTC, Gary Willoughby 
wrote:
 I've used the installation guide here: 
 http://wiki.dlang.org/Building_LDC_from_source

 And when i compile using the different switches i get these 
 errors:

 ---

 rdmd --build-only --compiler=ldmd2 --force -m64 -property 
 -release -w main.d

 0  ldc2            0x00000000014a50a2 
 llvm::sys::PrintStackTrace(_IO_FILE*) + 34
 1  ldc2            0x00000000014a4e99
 2  libpthread.so.0 0x00007f3ef263b030
 3  ldc2            0x0000000000735242 
 AndAndExp::toElem(IRState*) + 450
 4  ldc2            0x000000000072e3ac 
 Expression::toElemDtor(IRState*) + 540
 5  ldc2            0x000000000071fa4b 
 ExpStatement::toIR(IRState*) + 91
 6  ldc2            0x000000000071f2e9 
 CompoundStatement::toIR(IRState*) + 89
 Error: Error executing /usr/local/bin/ldc2: Segmentation fault
Hm. Could you please provide some more details? LLVM version, OS, ...
 rdmd --build-only --compiler=ldmd2 --force -m64 -property -w 
 main.d

 /tmp/.rdmd-1001/rdmd-main.d-2FB5FF642A0B7560CCCD18961A5DFC13/objs/main.o:(.rodata._D123TypeInfo_S3std8typecons86__T10RefCountedTS3std4file15DirIteratorImplVE3std8typecons24RefCountedAutoInitialize0Z10RefCounted6__initZ[_D123TypeInfo_S3std8typecons86__T10RefCountedTS3std4file15DirIteratorImplVE3std8typecons24RefCountedAutoInitialize0Z10RefCou
ted6__initZ]+0x60): 
 undefined reference to 
 `_D3std8typecons86__T10RefCountedTS3std4file15DirIteratorImplVE3std8typecons24RefCountedAutoInitialize0Z10RefCounted10__postblitMFZv'
 collect2: error: ld returned 1 exit status
 Error: /usr/bin/gcc failed with status: 1
I think this is issue 454 (https://github.com/ldc-developers/ldc/issues/454). Kai
Oct 10 2013
parent "Gary Willoughby" <dev nomad.so> writes:
On Thursday, 10 October 2013 at 11:51:20 UTC, Kai Nacke wrote:
 Hm. Could you please provide some more details? LLVM version, 
 OS, ...
Debian7, llvm-3.4
 I think this is issue 454 
 (https://github.com/ldc-developers/ldc/issues/454).

 Kai
Damn, i think it is! :/
Oct 10 2013
prev sibling parent reply David Nadlinger <code klickverbot.at> writes:
On Thu, Oct 10, 2013 at 1:39 PM, Gary Willoughby <dev nomad.so> wrote:
 rdmd --build-only --compiler=ldmd2 --force -m64 -property -release -w main.d

 0  ldc2            0x00000000014a50a2 llvm::sys::PrintStackTrace(_IO_FILE*)
 + 34
 1  ldc2            0x00000000014a4e99
 2  libpthread.so.0 0x00007f3ef263b030
 3  ldc2            0x0000000000735242 AndAndExp::toElem(IRState*) + 450
 4  ldc2            0x000000000072e3ac Expression::toElemDtor(IRState*) + 540
 5  ldc2            0x000000000071fa4b ExpStatement::toIR(IRState*) + 91
 6  ldc2            0x000000000071f2e9 CompoundStatement::toIR(IRState*) + 89
 Error: Error executing /usr/local/bin/ldc2: Segmentation fault
We are going to need some kind of test case to be able to track this down. David
Oct 10 2013
parent reply "Gary Willoughby" <dev nomad.so> writes:
On Thursday, 10 October 2013 at 16:35:34 UTC, David Nadlinger 
wrote:
 We are going to need some kind of test case to be able to track 
 this down.

 David
Here's a simple test case, save as file.d import std.stdio; import std.file; void main() { auto entries = dirEntries(".", "*", SpanMode.shallow, false); writeln("crashes before this compiles"); } Compile with: rdmd --compiler=ldc2 file.d Error: /tmp/.rdmd-1001/rdmd-test.d-E715299626833E7BD89AAECC25A35A6B/test.o:(.rodata._D123TypeInfo_S3std8typecons86__T10RefCountedTS3std4file15DirIteratorImplVE3std8typecons24RefCountedAutoInitialize0Z10RefCounted6__initZ[_D123TypeInfo_S3std8typecons86__T10RefCountedTS3std4file15DirIteratorImplVE3std8typecons24RefCountedAutoInitialize0Z10RefCou ted6__initZ]+0x60): undefined reference to `_D3std8typecons86__T10RefCountedTS3std4file15DirIteratorImplVE3std8typecons24RefCountedAutoInitialize0Z10RefCounted10__postblitMFZv' collect2: error: ld returned 1 exit status Error: /usr/bin/gcc failed with status: 1
Oct 11 2013
parent David Nadlinger <code klickverbot.at> writes:
On Fri, Oct 11, 2013 at 1:04 PM, Gary Willoughby <dev nomad.so> wrote:
 Here's a simple test case, save as file.d
 [=E2=80=A6]
Thanks for your efforts, but we already had a test case for that bug in the linked bug report. That's also why I quoted the other one in my earlier message, the crash in AndAndExp::toElem. There, we don't know anything besides the fact that there *might* be a problem in AndAndExp::toElem (possibly another i1/i8 issue?). Cheers, David
Oct 12 2013