Bug 1385 – Stack Overflow with huge array literal.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2007-07-30T11:03:00Z
Last change time
2015-06-09T01:14:14Z
Keywords
ice-on-valid-code
Assigned to
bugzilla
Creator
jascha

Attachments

IDFilenameSummaryContent-TypeSize
332testcase1385.dReduced test casetext/plain21863

Comments

Comment #0 by jascha — 2007-07-30T11:03:17Z
DMD crashes with a stack overflow when compiling this file: http://mainia.de/large_parser.d It's probably caused by a large array literal. Smaller parsers compile fine, for example: http://mainia.de/small_parser.d (this one needs http://mainia.de/container.d)
Comment #1 by jascha — 2007-07-31T13:18:17Z
This doesn't happen if the array literals are initializers. In large_parser.d the large array literals appeared in the constructor - DMD crashes. The following example uses them as const initializers and it compiles without problems: http://mainia.de/large_parser2.d
Comment #2 by clugdbug — 2009-04-21T06:28:11Z
Created attachment 332 Reduced test case Reduced test case. Clearly shows it's caused by the large array literal. On my system, the smallest array literal which caused a stack overflow was 10776 elements. Needs to be inside a function. void main() { ubyte[] data = [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ... 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0]; } --- Stack overflow.
Comment #3 by clugdbug — 2009-05-14T06:42:46Z
Fixed DMD2.030 and 1.045