digitalmars.D - Several segmentation faults
- Josh (8/8) May 28 2008 Has anyone had segmentation faults running the tutorials? This segfault...
- BCS (2/14) May 28 2008 does the compiler seg-v or does the compiled program?
- Josh (1/2) May 28 2008 The compiled program
- downs (5/16) May 28 2008 All I can say is there is nothing in there that I could possibly imagine...
- Chris Wright (3/23) May 29 2008 I've tried using gdc as installed from the Ubuntu repositories. The
- Lars (19/30) May 29 2008 I was searching for the answer to the exact same question. It seems that...
- Urban Hafner (5/6) May 29 2008 Which GDC build are you using? There's one built using GCC 4.1 and one
- Lars Kyllingstad (3/11) May 29 2008 In the repository it is listed as 0.25-4.2.3-2ubuntu2.
- Urban Hafner (6/17) May 29 2008 I just checked. I'm using 0.25-4.1.2-16ubuntu1. And the package is
- Josh (2/21) May 29 2008 Just to confirm, I tried compiling the same code on Ubuntu 8.04 using gd...
- Lars Kyllingstad (6/9) May 29 2008 That would explain why this started happening after I upgraded to Ubuntu...
Has anyone had segmentation faults running the tutorials? This segfaults on my computer (Ubuntu 8.04) using dgc. It's taken from one of the tutorials, but several similar tutorials also fail. import std.stdio; int magicNumber = 42; char[] password = "sesame"; void main() { writefln("Magic number: ", magicNumber); writefln("Password: ", password); }
May 28 2008
Reply to Josh,Has anyone had segmentation faults running the tutorials? This segfaults on my computer (Ubuntu 8.04) using dgc. It's taken from one of the tutorials, but several similar tutorials also fail. import std.stdio; int magicNumber = 42; char[] password = "sesame"; void main() { writefln("Magic number: ", magicNumber); writefln("Password: ", password); }does the compiler seg-v or does the compiled program?
May 28 2008
does the compiler seg-v or does the compiled program?The compiled program
May 28 2008
Josh wrote:Has anyone had segmentation faults running the tutorials? This segfaults on my computer (Ubuntu 8.04) using dgc. It's taken from one of the tutorials, but several similar tutorials also fail. import std.stdio; int magicNumber = 42; char[] password = "sesame"; void main() { writefln("Magic number: ", magicNumber); writefln("Password: ", password); }All I can say is there is nothing in there that I could possibly imagine segfaulting. Ergo it has to be a problem with your system. If you have too much free time, try to build GDC from sources. Out of curiosity, could you gdb the crashing program? --downs
May 28 2008
downs wrote:Josh wrote:I've tried using gdc as installed from the Ubuntu repositories. The programs it produces always segfault on vararg calls.Has anyone had segmentation faults running the tutorials? This segfaults on my computer (Ubuntu 8.04) using dgc. It's taken from one of the tutorials, but several similar tutorials also fail. import std.stdio; int magicNumber = 42; char[] password = "sesame"; void main() { writefln("Magic number: ", magicNumber); writefln("Password: ", password); }All I can say is there is nothing in there that I could possibly imagine segfaulting. Ergo it has to be a problem with your system. If you have too much free time, try to build GDC from sources. Out of curiosity, could you gdb the crashing program? --downs
May 29 2008
Josh Wrote:Has anyone had segmentation faults running the tutorials? This segfaults on my computer (Ubuntu 8.04) using dgc. It's taken from one of the tutorials, but several similar tutorials also fail. import std.stdio; int magicNumber = 42; char[] password = "sesame"; void main() { writefln("Magic number: ", magicNumber); writefln("Password: ", password); }I was searching for the answer to the exact same question. It seems that writef and writefln segfault whenever additional arguments are passed. Consider the following (modified) Hello World: import std.stdio; void main { writefln("Hello %s!", "world"); } When I compile this on my system (also running Ubuntu 8.04) with GDC and run it, it immediately segfaults without displaying the message. Just using writefln("Hello world!"); works perfectly, however. Some more testing shows that writing to other streams (files, etc.) doesn't work either. The printf() function works fine. Something wrong with the newest Ubuntu build of GDC, then? I tried running my hello-world program through GDB, this is the output I got: Starting program: /home/lars/development/programming/d/test/helloworld [Thread debugging using libthread_db enabled] [New Thread 0x7f0871deb6e0 (LWP 16622)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7f0871deb6e0 (LWP 16622)] 0x000000000040cfe9 in _D3std6format11doFormatPtrFDFwZvAC8TypeInfoG1S6object13__va_list_tagPvZv9formatA gMFaZv6putstrMFAaZv () Current language: auto; currently asm Regards, Lars
May 29 2008
Lars wrote:When I compile this on my system (also running Ubuntu 8.04) with GDC and run it, it immediately segfaults without displaying the message. Just usingWhich GDC build are you using? There's one built using GCC 4.1 and one using GCC 4.2, IIRC. The latter one also didn't work for me (on other more complex code). Urban
May 29 2008
Urban Hafner Wrote:Lars wrote:In the repository it is listed as 0.25-4.2.3-2ubuntu2. -LarsWhen I compile this on my system (also running Ubuntu 8.04) with GDC and run it, it immediately segfaults without displaying the message. Just usingWhich GDC build are you using? There's one built using GCC 4.1 and one using GCC 4.2, IIRC. The latter one also didn't work for me (on other more complex code). Urban
May 29 2008
Lars Kyllingstad wrote:Urban Hafner Wrote:I just checked. I'm using 0.25-4.1.2-16ubuntu1. And the package is called gdc-4.1. Maybe this works for you. The only thing is that you have to create a few symlinks, as the executable is called gdc-4.1 instead of gdc (the same for gdmd and maybe others). UrbanLars wrote:In the repository it is listed as 0.25-4.2.3-2ubuntu2.When I compile this on my system (also running Ubuntu 8.04) with GDC and run it, it immediately segfaults without displaying the message. Just usingWhich GDC build are you using? There's one built using GCC 4.1 and one using GCC 4.2, IIRC. The latter one also didn't work for me (on other more complex code). Urban
May 29 2008
Urban Hafner Wrote:Lars Kyllingstad wrote:Just to confirm, I tried compiling the same code on Ubuntu 8.04 using gdc-4.1 instead of gdc-4.2. The program ran fine. Thanks.Urban Hafner Wrote:I just checked. I'm using 0.25-4.1.2-16ubuntu1. And the package is called gdc-4.1. Maybe this works for you. The only thing is that you have to create a few symlinks, as the executable is called gdc-4.1 instead of gdc (the same for gdmd and maybe others). UrbanLars wrote:In the repository it is listed as 0.25-4.2.3-2ubuntu2.When I compile this on my system (also running Ubuntu 8.04) with GDC and run it, it immediately segfaults without displaying the message. Just usingWhich GDC build are you using? There's one built using GCC 4.1 and one using GCC 4.2, IIRC. The latter one also didn't work for me (on other more complex code). Urban
May 29 2008
Josh Wrote:Just to confirm, I tried compiling the same code on Ubuntu 8.04 using gdc-4.1 instead of gdc-4.2. The program ran fine. Thanks.That would explain why this started happening after I upgraded to Ubuntu 8.04. I guess the 4.1 build was the default in Ubuntu 7.10. Anyway, I have reported this as a bug on Launchpad. Feel free to add "me too"s. :) https://bugs.launchpad.net/ubuntu/+source/gdc-4.2/+bug/235955 Thanks, Lars
May 29 2008