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 tree-optimization/64715] [5.0 regression] __builtin_object_size (..., 1) fails to locate subobject


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.


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