Segfault while compiling simple program

Claude via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Dec 16 09:32:40 PST 2015


I tested it on linux (64-bit distro), and it segfaults as well:

-----

$ echo "struct S { ushort a, b; ubyte c, d; } struct T { ushort 
e; S s; }" > test.d

$ dmd -v test.d
binary    dmd
version   v2.069.0
config    /etc/dmd.conf
parse     test
importall test
import    object	(/usr/include/dmd/druntime/import/object.d)
semantic  test
Segmentation fault

$ uname -r
3.13.0-37-generic

$ cat /etc/issue
Linux Mint 17.1 Rebecca \n \l

$ dmd --version
DMD64 D Compiler v2.069.0
Copyright (c) 1999-2015 by Digital Mars written by Walter Bright

-----

It doesn't crash if compiled in 32-bit:

-----

$ dmd -v -m32 test.d
binary    dmd
version   v2.069.0
config    /etc/dmd.conf
parse     test
importall test
import    object	(/usr/include/dmd/druntime/import/object.d)
semantic  test
semantic2 test
semantic3 test
code      test
gcc test.o -o test -m32 -L/usr/lib/i386-linux-gnu -Xlinker 
--export-dynamic -Xlinker -Bstatic -lphobos2 -Xlinker -Bdynamic 
-lpthread -lm -lrt -ldl
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib32/crt1.o: In 
function `_start':
(.text+0x18): undefined reference to `main'
collect2: error: ld returned 1 exit status
--- errorlevel 1

-----

Using ubyte[2] or swapping the fields also solve the issue as 
mentioned above.

I also reproduce the issue using DMD v2.069.2.

So it may be good to add that information in the bug-report.




More information about the Digitalmars-d-learn mailing list