[Bug tree-optimization/82588] missing -Warray-bounds on a excessively large index
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Nov 16 16:25:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82588
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=82455
Resolution|--- |FIXED
--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
The -Warrray-bounds part of the issue has been fixed in r254830. GCC now
issues the warnings below for the test case in comment #0:
a.c: In function ‘f1’:
a.c:17:11: warning: array subscript 4611686018427387904 is above array bounds
of ‘int[]’ [-Warray-bounds]
return a[__SIZE_MAX__ / sizeof (int) + 1]; // missing -Warray-bounds
~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.c: In function ‘f2’:
a.c:22:14: warning: array subscript 9223372036854775807 is above array bounds
of ‘char[]’ [-Warray-bounds]
return a->a[__SIZE_MAX__ / 2]; // missing -Warray-bounds
~~~~^~~~~~~~~~~~~~~~~~
The out-of-bounds offset is still not diagnosed. It's the subject of a
separate bug (pr82455).
More information about the Gcc-bugs
mailing list