digitalmars.D.bugs - [Issue 23024] New: Large static array causes access violation on
- d-bugmail puremagic.com (35/35) Apr 16 2022 https://issues.dlang.org/show_bug.cgi?id=23024
https://issues.dlang.org/show_bug.cgi?id=23024 Issue ID: 23024 Summary: Large static array causes access violation on Windows with DMD Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: andy.pj.hanson gmail.com This program breaks on Windows when compiled with DMD: ``` import core.stdc.stdio : printf; static ulong[0x100000] data; extern(C) void main() { foreach (immutable size_t i; 0 .. data.length) { printf("Write to data[%llu]\n", i); data[i] = 42; } printf("Success\n"); } ``` The issue is an access violation. `dmd -m64 a.d && .\a.exe` fails before writing data[1007]. `dmd -m64 -g a.d && .\a.exe` fails before writing data[6]. (Removing the -m64 doesn't help. The difference with `-g` may be related to https://issues.dlang.org/show_bug.cgi?id=21763 .) `ldc2 a.d && .\a.exe` succeeds. And both dmd and ldc2 work on Linux. I'm testing this on a VMWare virtual machine in case that matters. Tested with dmd `v2.099.1-dirty`. --
Apr 16 2022