From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17954 invoked by alias); 22 Feb 2003 02:56:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 17915 invoked by uid 71); 22 Feb 2003 02:56:00 -0000 Resent-Date: 22 Feb 2003 02:56:00 -0000 Resent-Message-ID: <20030222025600.17914.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, corey.minter@intel.com Received: (qmail 12031 invoked by uid 48); 22 Feb 2003 02:48:16 -0000 Message-Id: <20030222024816.12030.qmail@sources.redhat.com> Date: Sat, 22 Feb 2003 02:56:00 -0000 From: corey.minter@intel.com Reply-To: corey.minter@intel.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c/9799: mismatching structure initializer with nested flexible array member, segfaults X-SW-Source: 2003-02/txt/msg01095.txt.bz2 List-Id: >Number: 9799 >Category: c >Synopsis: mismatching structure initializer with nested flexible array member, segfaults >Confidential: no >Severity: non-critical >Priority: low >Responsible: unassigned >State: open >Class: ice-on-illegal-code >Submitter-Id: net >Arrival-Date: Sat Feb 22 02:56:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Corey Minter >Release: 3.1 >Organization: >Environment: linux 2.4 >Description: Error message is... gcc_seg_fault.c:14: internal error: Segmentation fault Please submit a full bug report... The following illegal code caused a segfault instead of being flagged as an illegal structure initializer. Of course I stripped this down and changed the data and identifier names from my original code :). There are actually two errors in my code which I suppose "aligned" to trigger the segfault. Here is the code... // gcc_seg_fault.c typedef struct { int aaa; } s1_t; typedef struct { int bbb; s1_t s1_array[]; // <-- oops, array has no size } s2_t; static s2_t s2_array[]= { { 1, 4}, // <-- 4 should really be inside { } { 2, 5}, { 3, 6} }; The following code does work... // gcc_ok1.c typedef struct { int aaa; } s1_t; typedef struct { int bbb; s1_t s1_array[]; } s2_t; static s2_t s2_array[]= { { 1, {4}}, { 2, {5}}, { 3, {6}} }; and this works also... // gcc_ok2.c typedef struct { int aaa; } s1_t; typedef struct { int bbb; s1_t s1_array[2]; } s2_t; static s2_t s2_array[]= { { 1, 4}, { 2, 5}, { 3, 6} }; >How-To-Repeat: gcc -c gcc_seg_fault.c >Fix: >Release-Note: >Audit-Trail: >Unformatted: