1385 – Stack Overflow with huge array literal.

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1385 - Stack Overflow with huge array literal.
Summary: Stack Overflow with huge array literal.
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: Walter Bright
URL: http://mainia.de/large_parser.d
Keywords: ice-on-valid-code
Depends on:
Blocks:
Reported: 2007年07月30日 11:03 UTC by Jascha Wetzel
Modified: 2015年06月09日 01:14 UTC (History)
1 user (show)

See Also:


Attachments
Reduced test case (21.35 KB, text/plain)
2009年04月21日 06:28 UTC, Don
Details
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Jascha Wetzel 2007年07月30日 11:03:17 UTC
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 Jascha Wetzel 2007年07月31日 13:18:17 UTC
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 Don 2009年04月21日 06:28:11 UTC
Created attachment 332 [details] 
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 Don 2009年05月14日 06:42:46 UTC
Fixed DMD2.030 and 1.045


AltStyle によって変換されたページ (->オリジナル) /