From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2499 invoked by alias); 15 Nov 2008 21:42:18 -0000 Received: (qmail 24974 invoked by uid 48); 15 Nov 2008 21:40:57 -0000 Date: Sat, 15 Nov 2008 21:42:00 -0000 Message-ID: <20081115214057.24973.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c/38136] vim crashes on startup when compiled with -O3 but works with -O2 In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth at gcc dot gnu dot org" 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 X-SW-Source: 2008-11/txt/msg01254.txt.bz2 ------- Comment #5 from rguenth at gcc dot gnu dot org 2008-11-15 21:40 ------- The argument boils down to 6.5.6/8 which restricts pointer arithmetic on objects and 6.7.2.1/2 which forbids structures with an incomplete array at the end to be a member of a structure or element of an array. (This is all from the C99 standard - I do not have a C89 equivalent at hands) GCC explicitly supports [0] for C89 as a way to get the C99 [] semantics. GCC also tries to support arbitrary trailing arrays as of flexible length for legacy purposes. Certainly struct { struct { char x[]; }; char space[32]; }; is not allowed by C99. Replacing x[] with x[1] doesn't make it more valid. If using a union doesn't work that's too bad - but the standard doesn't explicitly allow that as an exception either (I now checked). Note that for analyzing why we do not support this usage for legacy reasons a (small) testcase to reproduce the failure is needed. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38136