Bug 77350

Summary: gcc3 segfaults on struct/flexible array with bad initializer.
Product: [Retired] Red Hat Linux Reporter: Joe Krahn <krahn>
Component: gcc3Assignee: Jakub Jelinek <jakub>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: low Docs Contact:
Priority: medium    
Version: 8.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-10-01 20:39:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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:
Always

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

Actual Results:  bug.c:10: internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla/> 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.