Bug 1542 – static array size limitation is too restrictive
Status
RESOLVED
Resolution
WONTFIX
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2007-10-01T10:55:00Z
Last change time
2014-02-17T22:50:56Z
Keywords
patch, rejects-valid
Assigned to
bugzilla
Creator
dlang-bugzilla
Comments
Comment #0 by dlang-bugzilla — 2007-10-01T10:55:28Z
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
Comment #1 by bugzilla — 2008-11-12T04:41:54Z
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.