This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/37130] warning: array subscript is above array bounds.
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Aug 2008 22:54:54 -0000
- Subject: [Bug middle-end/37130] warning: array subscript is above array bounds.
- References: <bug-37130-3783@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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