public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c/9800: mismatching structure initializer with nested flexible array member, segfaults
@ 2003-02-22 2:56 corey.minter
0 siblings, 0 replies; 2+ messages in thread
From: corey.minter @ 2003-02-22 2:56 UTC (permalink / raw)
To: gcc-gnats
>Number: 9800
>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:
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: c/9800: mismatching structure initializer with nested flexible array member, segfaults
@ 2003-02-22 9:05 paolo
0 siblings, 0 replies; 2+ messages in thread
From: paolo @ 2003-02-22 9:05 UTC (permalink / raw)
To: corey.minter, gcc-bugs, gcc-prs, nobody
Synopsis: mismatching structure initializer with nested flexible array member, segfaults
State-Changed-From-To: open->closed
State-Changed-By: paolo
State-Changed-When: Sat Feb 22 09:05:44 2003
State-Changed-Why:
Exact duplicate of c/9799.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9800
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-02-22 9:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-22 2:56 c/9800: mismatching structure initializer with nested flexible array member, segfaults corey.minter
2003-02-22 9:05 paolo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).