[Issue 14768] Error: index 174762 overflow for static array

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Jul 3 22:14:01 PDT 2015


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

--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to deadalnix from comment #0)
> enum Items = 174762;
> uint[32][Items]* items;

In front-end code, the total size of static array type is limited by 0x1000000,
and

uint.sizeof * 32 * 174762 = 22369536 = 0x1555500

Therefore the overflow error is not a bug.

In fact, the overflow error is raised from 2.060, in windows platform.

I'm not sure why it had not been checked in Linux platform, but an overflow
check logic refactoring had actually introduced in:

https://github.com/D-Programming-Language/dmd/pull/3949

So I guess there was an accepts-invalid bug, and it's fortunately fixed.

--


More information about the Digitalmars-d-bugs mailing list