Thread overview
[Issue 1542] New: static array size limitation is too restrictive
Oct 01, 2007
d-bugmail
Oct 01, 2007
BCS
Nov 12, 2008
d-bugmail
October 01, 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@digitalmars.com
        ReportedBy: thecybershadow@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


-- 

October 01, 2007
d-bugmail@puremagic.com wrote:
> 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@digitalmars.com
>         ReportedBy: thecybershadow@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
> 
> 


Congrats, you are Nuts! (I'm not making fun of you, I'm nuts to and I rater enjoy the condition)
November 12, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1542


bugzilla@digitalmars.com changed:

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




------- Comment #1 from bugzilla@digitalmars.com  2008-11-12 04:41 -------
The linker (optlink) fails with symbols that have more than 16Kb of static data. It isn't an onerous restriction, as the array can be easily new'd instead.


--