From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21402 invoked by alias); 29 Aug 2013 12:39:32 -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 21375 invoked by uid 48); 29 Aug 2013 12:39:29 -0000 From: "mikpe at it dot uu.se" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/58270] Wrong code while accessing array elements in a global structure Date: Thu, 29 Aug 2013 12:39:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 4.7.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: critical X-Bugzilla-Who: mikpe at it dot uu.se X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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: 2013-08/txt/msg01549.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58270 --- Comment #7 from Mikael Pettersson --- Your examples are invalid C. In one module you present the compiler with a specific declaration, and complain when it utilizes constraints derived from that declaration. Then in another module you have an _incompatible_ declaration for the same object. You can't expect to get away with that, even if it seemed to work with an older compiler. You should use a C99 "flexible array member", or a pointer (to an array of unknown size).