[Bug c/68325] missing -Warray-bounds on a negative subscript into a flexible array member
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Nov 16 16:27:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68325
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Known to work| |8.0
Resolution|--- |FIXED
Target Milestone|--- |8.0
Known to fail| |5.4.0, 6.4.0, 7.2.0
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Fixed in r254830. GCC now issues the warnings below for the test case in
comment #0:
z.c: In function ‘foo’:
z.c:7:16: warning: array subscript -2147483647 is below array bounds of
‘int[99]’ [-Warray-bounds]
return s.a [-__INT_MAX__];
~~~~^~~~~~~~~~~~~~
z.c: In function ‘bar’:
z.c:12:17: warning: array subscript -2147483647 is below array bounds of
‘int[99]’ [-Warray-bounds]
return p->a [-__INT_MAX__];
~~~~~^~~~~~~~~~~~~~
More information about the Gcc-bugs
mailing list