[Issue 24377] Error: negative array dimension `3145728u * 1024u`[32bit]

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 10 12:51:48 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=24377

--- Comment #4 from kdevel <kdevel at vogtner.de> ---
(In reply to Iain Buclaw from comment #3)
> You're allocating an array that takes up more than half the address space,
> so that is already pretty dubious.
Up to about 3.5 GiB the allocation is legit in 32 bit mode. But even with a 2
GiB allocation the error shows up:

$ cat nad2g.d
import std.stdio;

void main()
{
   auto arr = new char [2u * 1024 * 1024 * 1024]; // <--- error
   writefln ("%X", arr.length);
}
$ dmd -m32 nad2g.d 
nad2g.d(5): Error: negative array dimension `2097152u * 1024u`

--


More information about the Digitalmars-d-bugs mailing list