From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25543 invoked by alias); 9 Jan 2014 20:09:29 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 12441 invoked by uid 48); 9 Jan 2014 19:36:08 -0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/28865] Structures with a flexible arrray member have wrong .size Date: Thu, 09 Jan 2014 20:09:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 4.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.7.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-01/txt/msg00968.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28865 --- Comment #13 from Jakub Jelinek --- 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; }