[Bug middle-end/37130] warning: array subscript is above array bounds.
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sat Aug 16 22:56:00 GMT 2008
------- Comment #2 from pinskia at gcc dot gnu dot org 2008-08-16 22:54 -------
__insertion_sort (&entry.node_id[0], &entry.node_id[16]);
The length is only 4.
One issue is that we don't reduce:
D.8167 = &entry.node_id[0] + (unsigned int) num_side_vert * 4;
if (&entry.node_id[0] != D.8167)
Into:
if ((unsigned int)num_side_vert * 4 != 0)
So I think the other issue is that the code for std::sort assumes that it will
be a pointer and an array with a small size.
The warning is only partly bogus but since this is only runtime undefinedness,
this is valid code. The function get_int better never return more than 4
really.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37130
More information about the Gcc-bugs
mailing list