[Bug tree-optimization/64715] [5.0 regression] __builtin_object_size (..., 1) fails to locate subobject
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jan 22 10:29:00 GMT 2015
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.
More information about the Gcc-bugs
mailing list