[Issue 24377] New: Error: negative array dimension `3145728u * 1024u`[32bit]
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Feb 8 22:09:50 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=24377
Issue ID: 24377
Summary: Error: negative array dimension `3145728u *
1024u`[32bit]
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: kdevel at vogtner.de
$ cat nad.d
import std.stdio;
void main()
{
auto arr = new char [3u * 1024 * 1024 * 1024]; // <--- error
writefln ("%X", arr.length);
}
$ dmd -m32 ./nad.d
./nad.d(5): Error: negative array dimension `3145728u * 1024u` [unexpected]
$ gdc -m32 nad.d -o nad
$ ./nad
C0000000 [expected]
$ cat nad2.d
import std.stdio;
void main()
{
auto siz = 3u * 1024 * 1024 * 1024;
auto arr = new char [siz];
writefln ("%X", arr.length);
}
$ dmd -m32 ./nad2.d
$ ./nad2
C0000000 [expected]
used compilers:
- DMD64 D Compiler v2.105.3
- gcc (GCC) 12.1.0
--
More information about the Digitalmars-d-bugs
mailing list