This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/64715] [5.0 regression] __builtin_object_size (..., 1) fails to locate subobject
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 22 Jan 2015 10:28:55 +0000
- Subject: [Bug tree-optimization/64715] [5.0 regression] __builtin_object_size (..., 1) fails to locate subobject
- Auto-submitted: auto-generated
- References: <bug-64715-4 at http dot gcc dot gnu dot org/bugzilla/>
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.