[Issue 1542] New: static array size limitation is too restrictive

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 1 08:55:29 PDT 2007


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

           Summary: static array size limitation is too restrictive
           Product: D
           Version: 1.021
          Platform: PC
        OS/Version: All
            Status: NEW
          Keywords: patch, rejects-valid
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: thecybershadow at gmail.com


Source:
uint[4096][4096] myBigMap;

Output:
bug.d(1): Error: index 4096 overflow for static array

Remarks:
I do not see the purpose for this 'reasonable' limit (as it is called in the
source code). That range is well inside the 32-bit addressing space, and the
size is not restricted by any stack size or data segment restrictions.

Patch:
--- mtype_.c    2007-07-21 22:10:02.000000000 +0300
+++ mtype.c     2007-10-01 18:45:24.828125000 +0300
@@ -1832,8 +1832,6 @@
            n2 = n * d2;
            if ((int)n2 < 0)
                goto Loverflow;
-           if (n2 >= 0x1000000)        // put a 'reasonable' limit on it
-               goto Loverflow;
            if (n && n2 / n != d2)
            {
              Loverflow:

My temporary workaround:
Hex-edited the exe :P

Comparing files C:\DOWNLOADS\DMD.1.021\DMD\BIN\dmd.exe and
C:\SOFT\DMD\BIN\DMD.EXE
000086A1: 73 90
000086A2: 2B 90


-- 



More information about the Digitalmars-d-bugs mailing list