www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - rdmd main.d leads to Segmentation fault

reply Timoses <timosesu gmail.com> writes:
Hey,

simple hello world crashes with segfault:

import std.stdio;
void main()
{
     writeln("hi");
}

$ rdmd main.d
Segmentation fault

Same problem with a vibe.d project.

Just set up this VirtualBox


$ dmd --version
DMD32 D Compiler v2.078.1
$ rdmd --version
rdmd build 20180121
...
$ uname -a
Linux timoses-home-debian 4.9.0-4-686 #1 SMP Debian 
4.9.65-3+deb9u1 (2017-12-23) i686 GNU/Linux


$ dmd main.d
$ gdb ./main
(gdb) r
Starting program: /home/timoses/test3/main
[Thread debugging using libthread_db enabled]
Using host libthread_db library 
"/lib/i386-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00432e04 in _d_dso_registry ()
(gdb) bt
#0  0x00432e04 in _d_dso_registry ()
#1  0x00431c63 in ?? ()
#2  0x0045c08b in __libc_csu_init ()
#3  0xb7d8e206 in __libc_start_main (main=0x431c24 <main>, 
argc=1, argv=0xbffff784,
     init=0x45c040 <__libc_csu_init>, fini=0x45c0a0 
<__libc_csu_fini>,
     rtld_fini=0xb7feb080 <_dl_fini>, stack_end=0xbffff77c) at 
../csu/libc-start.c:247
#4  0x004315c1 in _start ()



Any ideas?
Jan 26
next sibling parent reply Fra Mecca <me francescomecca.eu> writes:
On Friday, 26 January 2018 at 22:40:29 UTC, Timoses wrote:
 Hey,

 simple hello world crashes with segfault:

 [...]
Where did you get the D toolchain? Does the same segmentation fault happen with dmd or gdc or ldc? (dmd should be the more probable) Can you compile a dub project?
Jan 26
parent reply Timoses <timosesu gmail.com> writes:
On Saturday, 27 January 2018 at 01:23:44 UTC, Fra Mecca wrote:
 On Friday, 26 January 2018 at 22:40:29 UTC, Timoses wrote:
 Hey,

 simple hello world crashes with segfault:

 [...]
Where did you get the D toolchain?
Got it from here: http://d-apt.sourceforge.net/ with $ apt-get install dmd-compiler
 Does the same segmentation fault happen with dmd or gdc or ldc? 
 (dmd should be the more probable)
dmd: generated executable also leads to segfault gdc: works... ldc: didn't try $ gdc --version gdc (Debian 6.3.0-18) 6.3.0 20170516
 Can you compile a dub project?
No, leads to executable causing a segfault as well So, it does compile, but compiled executable with dmd seems to cause segfault.
Jan 28
parent Kagamin <spam here.lot> writes:
On Sunday, 28 January 2018 at 21:41:39 UTC, Timoses wrote:
 Got it from here:
 http://d-apt.sourceforge.net/
 with

 $ apt-get install dmd-compiler
Sometimes such crashes can be caused by files left from previous installation. Or maybe confusion between gdc and dmd files.
Jan 30
prev sibling next sibling parent reply Kagamin <spam here.lot> writes:
On Friday, 26 January 2018 at 22:40:29 UTC, Timoses wrote:
 Program received signal SIGSEGV, Segmentation fault.
 0x00432e04 in _d_dso_registry ()
 (gdb) bt
 #0  0x00432e04 in _d_dso_registry ()
 #1  0x00431c63 in ?? ()
 #2  0x0045c08b in __libc_csu_init ()
 #3  0xb7d8e206 in __libc_start_main (main=0x431c24 <main>, 
 argc=1, argv=0xbffff784,
     init=0x45c040 <__libc_csu_init>, fini=0x45c0a0 
 <__libc_csu_fini>,
     rtld_fini=0xb7feb080 <_dl_fini>, stack_end=0xbffff77c) at 
 ../csu/libc-start.c:247
 #4  0x004315c1 in _start ()



 Any ideas?
What `disas` command shows at the point of failure?
Jan 27
parent reply Timoses <timosesu gmail.com> writes:
On Saturday, 27 January 2018 at 21:04:07 UTC, Kagamin wrote:
 On Friday, 26 January 2018 at 22:40:29 UTC, Timoses wrote:
 Program received signal SIGSEGV, Segmentation fault.
 0x00432e04 in _d_dso_registry ()
 (gdb) bt
 #0  0x00432e04 in _d_dso_registry ()
 #1  0x00431c63 in ?? ()
 #2  0x0045c08b in __libc_csu_init ()
 #3  0xb7d8e206 in __libc_start_main (main=0x431c24 <main>, 
 argc=1, argv=0xbffff784,
     init=0x45c040 <__libc_csu_init>, fini=0x45c0a0 
 <__libc_csu_fini>,
     rtld_fini=0xb7feb080 <_dl_fini>, stack_end=0xbffff77c) at 
 ../csu/libc-start.c:247
 #4  0x004315c1 in _start ()



 Any ideas?
What `disas` command shows at the point of failure?
How would I do that? $ (gdb) info line main No line number information available for address 0x431c24 <main> $ (gdb) info line 0x431c24 Function "0x431c24" not defined. ?
Jan 28
parent reply Kagamin <spam here.lot> writes:
On Sunday, 28 January 2018 at 22:02:11 UTC, Timoses wrote:
 How would I do that?
https://forum.dlang.org/post/mailman.39.1510078013.9493.digitalmars d-ldc puremagic.com like this
Jan 30
parent reply Timoses <timosesu gmail.com> writes:
On Tuesday, 30 January 2018 at 14:08:35 UTC, Kagamin wrote:
 On Sunday, 28 January 2018 at 22:02:11 UTC, Timoses wrote:
 How would I do that?
https://forum.dlang.org/post/mailman.39.1510078013.9493.digitalmars d-ldc puremagic.com like this
Thanks! I did $ gdb main $ (gdb) set logging on $ (gdb) r $ (gdb) disas Output: https://pastebin.com/raw/SSx0P1Av Helps?
Jan 30
parent reply Kagamin <spam here.lot> writes:
On Tuesday, 30 January 2018 at 16:56:28 UTC, Timoses wrote:
 Output:
 https://pastebin.com/raw/SSx0P1Av

 Helps?
Looks like TLS is not initialized.
Jan 31
parent reply Timoses <timosesu gmail.com> writes:
On Wednesday, 31 January 2018 at 08:40:26 UTC, Kagamin wrote:
 On Tuesday, 30 January 2018 at 16:56:28 UTC, Timoses wrote:
 Output:
 https://pastebin.com/raw/SSx0P1Av

 Helps?
Looks like TLS is not initialized.
And I would need to do what about it? Sorry, I'm not familiar with assembly code stuff in detail.
Jan 31
parent reply Kagamin <spam here.lot> writes:
On Wednesday, 31 January 2018 at 16:59:15 UTC, Timoses wrote:
 And I would need to do what about it?

 Sorry, I'm not familiar with assembly code stuff in detail.
You can try to see if it works on another distro or version.
Feb 01
parent reply Timoses <timosesu gmail.com> writes:
On Thursday, 1 February 2018 at 09:01:34 UTC, Kagamin wrote:
 On Wednesday, 31 January 2018 at 16:59:15 UTC, Timoses wrote:
 And I would need to do what about it?

 Sorry, I'm not familiar with assembly code stuff in detail.
You can try to see if it works on another distro or version.
It does work on debian jessie. Stretch failed..
Feb 04
parent reply Martin Tschierschke <mt smartdolphin.de> writes:
On Sunday, 4 February 2018 at 11:50:05 UTC, Timoses wrote:
 On Thursday, 1 February 2018 at 09:01:34 UTC, Kagamin wrote:
 On Wednesday, 31 January 2018 at 16:59:15 UTC, Timoses wrote:
 And I would need to do what about it?

 Sorry, I'm not familiar with assembly code stuff in detail.
You can try to see if it works on another distro or version.
It does work on debian jessie. Stretch failed..
It looks like I have the same issue, I got: gdb hiworld core Core was generated by `./hiworld'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x800fbf73 in _d_dso_registry () ldc2 is working. My system: Ubuntu 17.10 32 Bit 4.10.0-37-generic #41-Ubuntu SMP Fri Oct 6 20:20:00 UTC 2017 i686 i686 i686 GNU/Linux (No problems on our office system Ubuntu 16.04 64Bit, too) I tried older DMD (from 2017 and 2016!), because I already used DMD on this system, but I got the same same effect. I am unfamiliar with debugging (gdb etc.) so any hint would be appreciated!
Feb 12
parent reply Kagamin <spam here.lot> writes:
On Tuesday, 13 February 2018 at 06:53:46 UTC, Martin Tschierschke 
wrote:
 I am unfamiliar with debugging (gdb etc.) so any hint would be 
 appreciated!
https://issues.dlang.org/show_bug.cgi?id=18350 - maybe adjust bug severity.
Feb 14
parent Martin Tschierschke <mt smartdolphin.de> writes:
On Wednesday, 14 February 2018 at 10:28:51 UTC, Kagamin wrote:
 On Tuesday, 13 February 2018 at 06:53:46 UTC, Martin 
 Tschierschke wrote:
 I am unfamiliar with debugging (gdb etc.) so any hint would be 
 appreciated!
https://issues.dlang.org/show_bug.cgi?id=18350 - maybe adjust bug severity.
I added a comment and increased prio, OK to do it like this? I may post my gdb results in the MET evening later, should I?
Feb 14
prev sibling parent reply Stefan Koch <uplink.coder googlemail.com> writes:
On Friday, 26 January 2018 at 22:40:29 UTC, Timoses wrote:
 Hey,

 simple hello world crashes with segfault:

 [...]
I can not reproduce this.
Jan 29
parent Timoses <timosesu gmail.com> writes:
On Monday, 29 January 2018 at 15:03:48 UTC, Stefan Koch wrote:
 On Friday, 26 January 2018 at 22:40:29 UTC, Timoses wrote:
 Hey,

 simple hello world crashes with segfault:

 [...]
I can not reproduce this.
Well, the cause is not yet uncovered, I suppose... Any more ideas?
Jan 29