www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: mrmocool gmx.de



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: -------
Aug 10 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4611




Never mind, class is in that list because size() simply returns PTRSIZE.

So the question is if there are any forward reference cases where this patch
fails because of

unsigned AggregateDeclaration::size(Loc loc)
{
    //printf("AggregateDeclaration::size() = %d\n", structsize);
    if (!members)
        error(loc, "unknown size");
    if (sizeok != 1 && scope)
        semantic(NULL);
    if (sizeok != 1)
    {   error(loc, "no size yet for forward reference");
        //*(char*)0=0;
    }
    return structsize;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 10 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4611


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|diagnostic                  |ice-on-invalid-code
                 CC|                            |clugdbug yahoo.com.au



This variation is ICE(cgcod.c):

struct Vec
{
    int x;
}

void main()
{
    Vec[1000_000_000] a;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 05 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4611


Walter Bright <bugzilla digitalmars.com> changed:

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



19:15:36 PDT ---
D2 fix:

https://github.com/D-Programming-Language/dmd/pull/2624

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 03 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4611




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/53645e4508880df0bf6ce0fd78c5596e075dddb4
fix Issue 4611 - stack overflow or ICE(cgcod.c) when static array of structs
exceeds 16MB limit

https://github.com/D-Programming-Language/dmd/commit/3e87ccdd4db2e4581b799af728ed36f58dcd29c1


fix Issue 4611 - stack overflow or ICE(cgcod.c) when static array of str...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 05 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4611




Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/5e9152194f589d2e3556d87e99edb9865bdab6dd


fix Issue 4611 - stack overflow or ICE(cgcod.c) when static array of str...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 05 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4611


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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