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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Of course the question is whether

int
main (void)
{
  struct A { char buf1[9]; char buf2[1]; } a;

  char *p = a.buf1;
  p += 4;

  strcpy (p, str1 + 5);
}

should detect a buffer overflow - because that's what the original testcase
boils down to.  GCC 4.9 doesn't detect a buffer overflow here - a bug?
What is "the closest surrounding object" 'p' points to?  What is an "object"
in C terms?  (what is it in C++ terms?)

I start to believe the testcase is ill-formed and should have used
&a.buf1[4] instead which works fine with GCC 5.

Reply via email to