This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/28865] Structures with a flexible arrray member have wrong .size
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 09 Jan 2014 19:35:59 +0000
- Subject: [Bug middle-end/28865] Structures with a flexible arrray member have wrong .size
- Auto-submitted: auto-generated
- References: <bug-28865-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28865
--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Runtime testcase that presumably fails on -fsection-anchors targets:
struct A { int a; char b[]; };
union B { struct A a; char b[sizeof (struct A) + 31]; };
union B b = { { 1, "123456789012345678901234567890" } };
union B c = { { 2, "123456789012345678901234567890" } };
__attribute__((noinline, noclone)) void
foo (int *x[2])
{
x[0] = &b.a.a;
x[1] = &c.a.a;
}
int
main ()
{
int *x[2];
foo (x);
if (*x[0] != 1 || *x[1] != 2)
__builtin_abort ();
return 0;
}