From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31263 invoked by alias); 10 Jan 2014 23:13:19 -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 31180 invoked by uid 48); 10 Jan 2014 23:13:15 -0000 From: "amodra at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/28865] Structures with a flexible arrray member have wrong .size Date: Fri, 10 Jan 2014 23:13: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: amodra at gmail dot com 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/msg01206.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28865 --- Comment #17 from Alan Modra --- I believe Eric's comment http://gcc.gnu.org/ml/gcc-patches/2013-05/msg00179.html points at the correct fix, but it's a bit messy. You need to recursively descend both "decl" and "init" in code like c-decl.c:finish_decl, updating "decl" component sizes for any variable length arrays you find, rather than handling just a top level variable length array as we do currently. Then repeat the exercise for other language versions of finish_decl..