From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 570 invoked by alias); 13 Jan 2014 17:47:14 -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 495 invoked by uid 48); 13 Jan 2014 17:47:11 -0000 From: "nickc 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: Mon, 13 Jan 2014 17:47: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: nickc 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: attachments.isobsolete attachments.created 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/msg01384.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28865 Nick Clifton changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #31802|0 |1 is obsolete| | --- Comment #23 from Nick Clifton --- Created attachment 31823 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31823&action=edit Revised patch, with testcases Hi Guys, I have uploaded a revised patch with two changes: 1. I have removed the assertion from output_constructor_regular_field() and changed the code so that extra zeros are emitted only if fieldpos is more than the current byte total. I made this change because I feel that we should avoid ICEs even on invalid code. 2. I have added two tests to the testsuite, based on comments 3 and 13. Still no regressions with an i686-pc-linux-gnu toolchain and an aarch64-elf toolchain. OK to apply ? Cheers Nick gcc/ChangeLog 2014-01-13 Nick Clifton PR middle-end/28865 * varasm.c (output_consant): Return the number of bytes actually emitted. (output_constructor_array_range): Update the field size with the number of bytes emitted by output_constant. (output_constructor_regular_field): Likewise. Also do not complain if the total number of bytes emitted is now greater than the expected fieldpos. * output.h (output_constant): Update prototype and descriptive comment. gcc/testsuite/ChangeLog 2014-01-13 Nick Clifton PR middle-end/28865 * gcc.c-torture/compile/pr28865.c: New. * gcc.c-torture/execute/pr28865.c: New.