------- Comment #3 from jmattson at vmware dot com  2010-05-27 20:31 -------
Admittedly, foo() makes some assumptions about alignment as originally written.
 A more pedantic version is:

static inline void
foo(int *p)
{
   if (p >= a + 1 && p < a + 10) {
      p[-1] = 0;
   }
}

gcc still generates a warning with this version.

Even if a[] and b[] overlap, the guard clause ensures that the expression
'p[-1]' is within the bounds of array a[].


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44300

Reply via email to