Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 77350 - gcc3 segfaults on struct/flexible array with bad initializer.
Summary: gcc3 segfaults on struct/flexible array with bad initializer.
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc3
Version: 8.0
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2002-11-05 17:41 UTC by Joe Krahn
Modified: 2007-04-18 16:48 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2004-10-01 20:39:48 UTC

Attachments (Terms of Use)

Description Joe Krahn 2002-11-05 17:41:09 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.79 [en] (X11; U; Linux 2.4.18-17.8.0 i686)

Description of problem:
I created some code with a variable sized type
within a struct typedef, then tried to initialize it with
data from another array (improper code).

This caused gcc3 to segfault. Seems to only occur with
bas code, so probably not a serious problem, except that
segfaults are always bad.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. run gcc3 -c on the code listed in Additional Info.

Actual Results:  bug.c:10: internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:> for instructions.

Expected Results:  This is what gcc 2.9x gives:
bug2.c:3: array size missing in `points'
bug2.c:8: incompatible types in initialization
bug2.c:8: initializer element is not constant
bug2.c:8: (near initialization for `p1.points[0][0]')

Additional info:

/* Example bug source (nice and short) */
typedef struct {
        int n;
        float points[][2];
} polygon_t ;

float p1_points[][2]={{1,2},{3,4}};

polygon_t p1 = { 2, p1_points };

Comment 1 Vladimir Makarov 2004-10-01 20:39:48 UTC
I've checked the current state of redhat gcc3 branch
(gcc-3_2-rhl8-branch).  The bug was gone.  Therefore we are closing
the case.

Note You need to log in before you can comment on or make changes to this bug.