Thread overview
[Issue 4904] New: Win32 phobos unittest crashes with access violation
Sep 21, 2010
Shin Fujishiro
Sep 21, 2010
Rainer Schuetze
May 28, 2011
Andrej Mitrovic
May 29, 2011
Don
May 29, 2011
Andrej Mitrovic
May 29, 2011
Don
May 29, 2011
Andrej Mitrovic
May 30, 2011
Rainer Schuetze
September 21, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4904

           Summary: Win32 phobos unittest crashes with access violation
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: rsinfu@gmail.com


--- Comment #0 from Shin Fujishiro <rsinfu@gmail.com> 2010-09-21 00:54:02 PDT ---
dmd r680
phobos trunk r2043

Paste the following code at the bottom of phobos/unittest.d. This simply increases the size of unittest executable.
--------------------
unittest
{
    struct K(Q...)
    {
        static if (Q.length < 5) static K!(Q, int) next;
        Q q;
    }
    static K!byte a1;
    static K!short a2;
    static K!int a3;
    static K!long a4;
    static K!ubyte a5;
    static K!ushort a6;
    static K!uint a7;
    static K!ulong a8;
    static K!float a9;
    static K!double a10;
    static K!real a11;
    static K!char a12;
    static K!wchar a13;
    static K!dchar a14;
}
--------------------

Then, run the phobos unittest on Windows. It will crash.
--------------------
>make -f win32.mak unittest
...
unittest
object.Error: Access Violation
--------------------

Access violation seems to start happening when the size of executable exceeds some critical point. Sometimes the AV didn't occur, and alternatively the test showed weird behavior - such as infinitely failing unittests or broken output.

See this message and follow ups.
 http://lists.puremagic.com/pipermail/phobos/2010-September/002609.html

Auto tester output:
 http://d.puremagic.com/test-results/test_data.ghtml?dataid=3525

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


Rainer Schuetze <r.sagitario@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario@gmx.de


--- Comment #1 from Rainer Schuetze <r.sagitario@gmx.de> 2010-09-21 11:07:51 PDT ---
Even with phobos svn revision 2014, dmd outputs 16424 symbols for the unittest executable, which triggers bug 3372 in optlink. It can generate any kind of bad behaviour.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 28, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4904


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-05-28 10:04:31 PDT ---
It looks like Walter's fixes for 3372 have worked, I can't recreate the AV on 2.053. Can we close this?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 29, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4904


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug@yahoo.com.au
         Resolution|                            |FIXED


--- Comment #3 from Don <clugdbug@yahoo.com.au> 2011-05-29 13:11:26 PDT ---
It was fixed by my refactoring of the makefile into three .obj files for unittest, instead of two.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 29, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4904



--- Comment #4 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-05-29 13:21:41 PDT ---
(In reply to comment #3)
> It was fixed by my refactoring of the makefile into three .obj files for unittest, instead of two.

You mean separating modules into SRCS_1, SRCS_2, and SRCS_3, like in the windows makefile? I've tried merging the 3, and it seems to work fine that way.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 29, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4904



--- Comment #5 from Don <clugdbug@yahoo.com.au> 2011-05-29 14:03:20 PDT ---
(In reply to comment #4)
> (In reply to comment #3)
> > It was fixed by my refactoring of the makefile into three .obj files for unittest, instead of two.
> 
> You mean separating modules into SRCS_1, SRCS_2, and SRCS_3, like in the windows makefile? I've tried merging the 3, and it seems to work fine that way.

The SRCS_1, SRCS_2, SRCS_3 in the makefile *is* the change I made. Note that the order is important. (The list of which modules are in which part is not arbitrary).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 29, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4904



--- Comment #6 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-05-29 14:23:47 PDT ---
(In reply to comment #5)
> (In reply to comment #4)
> > (In reply to comment #3)
> > > It was fixed by my refactoring of the makefile into three .obj files for unittest, instead of two.
> > 
> > You mean separating modules into SRCS_1, SRCS_2, and SRCS_3, like in the windows makefile? I've tried merging the 3, and it seems to work fine that way.
> 
> The SRCS_1, SRCS_2, SRCS_3 in the makefile *is* the change I made. Note that the order is important. (The list of which modules are in which part is not arbitrary).

Yeah, the comment in the makefile makes a note of why they're split. But I'm not getting any errors running unittests if I merge and compile them all at once, maybe the new optlink fixes whatever issues were had that made you split he modules like that.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 30, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4904



--- Comment #7 from Rainer Schuetze <r.sagitario@gmx.de> 2011-05-29 23:39:00 PDT ---
The optlink fix for 3372 increased the number of allowed symbols for each OMF object file from 16384 to 32768. So expect to hit that limit too with growing projects built into a single object file. In that case the compiler now reports an error.

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