www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23232] New: Static array limits are incorrect for -m64

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

          Issue ID: 23232
           Summary: Static array limits are incorrect for -m64
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: contact lsferreira.net

Even for -m32, the static array size is limited to int.max instead of uint.max.
This is a compiler backend specific issue, described here:
https://github.com/dlang/dmd/pull/6503/files#diff-180f4c4ac5e6c186006f676f9b372e0cfea2c34d17d7a13ac2796565f4955d50R71

The target static array size limit should be a configurable global in order to
other compiler backends accommodate their limits.

For -m64, the static array size remains the same of -m32.

Example code:

-m32
```
struct S {
    ubyte[(int.max / 2) - 1] value;
}
```

-m64
```
struct S {
    ubyte[(long.max / 2) - 1] value; // doesn't compile
}
```

--
Jul 08 2022