Jump to page: 1 2
Thread overview
[Issue 4854] New: writefln Segmentation fault if no globals
Sep 11, 2010
Alex Burton
Oct 15, 2010
wresch
Oct 16, 2010
Kyle Kilpatrick
Oct 16, 2010
Kyle Kilpatrick
[Issue 4854] Regression(2.047, Mac only) writefln Segmentation fault if no globals
Oct 18, 2010
Don
Nov 07, 2010
Don
Nov 08, 2010
Alex Burton
Nov 08, 2010
Walter Bright
Nov 08, 2010
Jacob Carlborg
Nov 08, 2010
Walter Bright
Nov 08, 2010
nfxjfg@gmail.com
Nov 09, 2010
Jacob Carlborg
Nov 20, 2010
Jacob Carlborg
[Issue 4854] Regression(2.047, Mac 10.5 only) writefln Segmentation fault if no globals
Feb 01, 2012
Jacob Carlborg
Feb 07, 2012
Walter Bright
Feb 07, 2012
Jacob Carlborg
Mar 08, 2012
Walter Bright
September 11, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4854

           Summary: writefln Segmentation fault if no globals
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Mac OS X
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: alexibu@mac.com


--- Comment #0 from Alex Burton <alexibu@mac.com> 2010-09-11 14:29:49 PDT ---
Hi,

I have dmd version 2.048, OS X 10.5.8

If I compile this :

import std.stdio;
int main()
{
    writefln("%d",0);
    return 0;
}

with "dmd file.d"

and then run it

I get segmentation fault in writefln

if I then compile this :

import std.stdio;
int x;
int main()
{
    writefln("%d",0);
    return 0;
}

and run it, it works.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 15, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4854


wresch <wresch@drgang.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wresch@drgang.net


--- Comment #1 from wresch <wresch@drgang.net> 2010-10-15 16:51:44 PDT ---
I have the exact same issue.  In the code below the segfault happens in writefln.

Setup:
Digital Mars D Compiler v2.049
OS X 10.5.3
2.26 MHz Core2 duo (macbook pro)

[510]dmd2 >  cat hello.d
import std.stdio;
//int x;

void main() {
    writeln("hello world!");
    writefln("foo = %d", 10);
}
[511]dmd2 >  ./hello
Segmentation fault
[515]dmd2 >  cat hello2.d
import std.stdio;
int x;

void main() {
    writeln("hello world!");
    writefln("foo = %d", 10);
}
[
[514]dmd2 >  ./hello2
hello world!
foo = 10

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 16, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4854


Kyle Kilpatrick <garfieldrules@sbcglobal.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |garfieldrules@sbcglobal.net


--- Comment #2 from Kyle Kilpatrick <garfieldrules@sbcglobal.net> 2010-10-15 17:04:55 PDT ---
I have the same problem.  In my OS X 10.5.8 installation, any program in my with a writef or writefln statement in DMD >= 2.047 segfaults.  Oddly, this problem is NOT present in DMD 2.046.  Readf in >= 2.047 also causes trouble.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 16, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4854



--- Comment #3 from Kyle Kilpatrick <garfieldrules@sbcglobal.net> 2010-10-15 17:08:27 PDT ---
My setup:

Digital Mars D 2.049
OS X 10.5.8
MacBook Black early 2008
Core 2 Duo 2.4ghz

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 18, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4854


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug@yahoo.com.au
            Summary|writefln Segmentation fault |Regression(2.047, Mac only)
                   |if no globals               |writefln Segmentation fault
                   |                            |if no globals
           Severity|major                       |regression


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 07, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4854



--- Comment #4 from Don <clugdbug@yahoo.com.au> 2010-11-07 13:51:01 PST ---
Can somebody please help to track this down further?
Does it crash with: import std.stdio;  void main() { writeln("abc", 0);}   ?
Does it crash with: import std.string; void main() { format("%d", 0); } ?
Does it crash with: import std.string; void main() { writefln("abc"); } ?

If it crashes with writeln, it's probably a compiler code generation bug, related to varargs.

And can you get a stack trace?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 08, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4854



--- Comment #5 from Alex Burton <alexibu@mac.com> 2010-11-08 01:51:46 PST ---
(In reply to comment #4)
> Can somebody please help to track this down further?
> Does it crash with: import std.stdio;  void main() { writeln("abc", 0);}   ?
YES
> Does it crash with: import std.string; void main() { format("%d", 0); } ?
NO
> Does it crash with: import std.string; void main() { writefln("abc"); } ?
assume you meant import std.stdio: YES
> 
> If it crashes with writeln, it's probably a compiler code generation bug, related to varargs.
> 
> And can you get a stack trace?

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: 13 at address: 0x00000000
0x0000a7b9 in __tls_get_addr ()
(gdb) bt
#0  0x0000a7b9 in __tls_get_addr ()
#1  0x000073a1 in _moduleTlsCtor ()
#2  0x0000fbfd in D2rt6dmain24mainUiPPaZi6runAllMFZv ()
#3  0x0000fb06 in D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv ()
#4  0x0000fa93 in main ()

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 08, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4854


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com


--- Comment #6 from Walter Bright <bugzilla@digitalmars.com> 2010-11-08 09:59:18 PST ---
I cannot reproduce this problem with OS X 10.6.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 08, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4854


Jacob Carlborg <doob@me.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |doob@me.com


--- Comment #7 from Jacob Carlborg <doob@me.com> 2010-11-08 12:34:49 PST ---
I can reproduce it on Mac OS X 10.5.8 using dmd 2.050.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 08, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4854



--- Comment #8 from Walter Bright <bugzilla@digitalmars.com> 2010-11-08 14:11:18 PST ---
I've had a lot of problems with the 10.5 linker screwing up on empty sections. I suspect the solution is for, a module that defines main(), to output 4 bytes of dummy data into the tls section if it is blank.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
« First   ‹ Prev
1 2