[Issue 10851] New: Stack trace missing for null object access in module constructor

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Aug 19 03:09:25 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10851

           Summary: Stack trace missing for null object access in module
                    constructor
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-08-19 03:09:24 PDT ---
-----
shared static this()
{
    class C
    {
        void foo() { }
    }

    C c;
    c.foo();
}

void main()
{
}
-----

$ dmd -g -run test.d
> object.Error: Access Violation

When using the same code in main, a proper stack trace is returned:

-----
module test;

void main()
{
    class C
    {
        void foo() { }
    }

    C c;
    c.foo();
}
-----

object.Error: Access Violation
----------------
0x0040201B in _Dmain at C:\dev\code\d_code\stack_trace_working.d(11)
0x004028E4 in extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).v
oid runMain()
0x00402974 in extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).v
oid runAll()
0x00402251 in _d_run_main
0x00402074 in main
0x004141AD in mainCRTStartup
0x766C33CA in BaseThreadInitThunk
0x77C19ED2 in RtlInitializeExceptionChain
0x77C19EA5 in RtlInitializeExceptionChain

Tested on Win 7 64bit.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list