This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/37130] warning: array subscript is above array bounds.



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]