http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50700
Bug #: 50700 Summary: [4.6/4.7 Regression] __builtin_object_size computed wrong Classification: Unclassified Product: gcc Version: 4.6.1 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: middle-end AssignedTo: unassig...@gcc.gnu.org ReportedBy: rgue...@gcc.gnu.org extern void abort (void); struct S { int len; char s[0]; }; int main() { char buf[sizeof (struct S) + 32]; if (__builtin_object_size (((struct S *)&buf[0])->s, 1) != 32) abort (); return 0; }