https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83688

--- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> ---
The warning does see that range (it's in the output of the -fdump-tree-vrp
option).  The challenge with using ranges is to avoid false positives from
excessive bounds.  For sizes, typically only the lower bound can be trusted. 
The upper bound is very often meaningless.  For instance, in something as
simple as the following, n's range is [0, UINT_MAX]:

  void test (unsigned n)
  {
    memcpy (buf, buf + 5, n);
  }

So all these warnings (-Warray-bounds, -Wformat-overflow, -Wrestrict,
-Wstringop-overflow, etc.) only use the more conservative of the two bounds,
usually the lower one.

Reply via email to