[Issue 22991] New: GC array literals restricted in size
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Apr 5 16:30:38 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=22991
Issue ID: 22991
Summary: GC array literals restricted in size
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: kinke at gmx.net
This segfaults at runtime with DMD v2.099.0 on Linux:
```
struct S {
void[32 * 1_048_576] bla;
}
public S* deserializeFull(int i) {
return &[ getS(i) ][0];
}
S getS(int i) {
if (i != 0)
throw new Exception("blub");
return S();
}
void main(string[] args) {
deserializeFull(cast(int) args.length);
}
```
Works fine with LDC.
DMD's glue layer apparently creates the literal as a static array on the stack,
before moving it to the GC allocation. This came up in
https://github.com/dlang/dmd/pull/13951.
--
More information about the Digitalmars-d-bugs
mailing list