[Issue 4611] New: static array of structs doesn't yield error message when exceeding 16MB limit

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 10 07:22:59 PDT 2010


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

           Summary: static array of structs doesn't yield error message
                    when exceeding 16MB limit
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic, patch, wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: mrmocool at gmx.de


--- Comment #0 from Trass3r <mrmocool at gmx.de> 2010-08-10 07:22:54 PDT ---
void main()
{
    const int w = 1024, h = 768;
    Vec[w*h] a;
}
struct Vec
{
    double x,y,z;
}

This doesn't yield an error message, it just crashes with Stack Overflow.


The following patch also works in the forward reference case shown above. I
wonder why class was in that list but not struct:

Index: G:/dmd/src/dmd/mtype.c
===================================================================
--- G:/dmd/src/dmd/mtype.c    (revision 608)
+++ G:/dmd/src/dmd/mtype.c    (working copy)
@@ -3351,6 +3351,7 @@
                  tbn->ty == Tarray ||
                  tbn->ty == Tsarray ||
                  tbn->ty == Taarray ||
+                  tbn->ty == Tstruct ||
                  tbn->ty == Tclass)
         {
             /* Only do this for types that don't need to have semantic()
             * run on them for the size, since they may be forward referenced.
             */

-- 
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