public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/14714] New: segfault when initializing a flexible array member using designated initializer
@ 2004-03-24 7:42 henryhack101 at netscape dot net
2004-03-24 7:49 ` [Bug c/14714] " henryhack101 at netscape dot net
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: henryhack101 at netscape dot net @ 2004-03-24 7:42 UTC (permalink / raw)
To: gcc-bugs
According to the docs, initilization of a flexible array member is allowed.
So the following should be legal right?
I would expect it to output "1 0 2" when run which is what I would get if I
declare the array as "int y [2]"
In any case, it should not seg fault.
henry@zulu:~/test> more t3.c
#include <stdio.h>
struct A {
int x;
int y [];
};
struct A a1 = {1,{[1]=2}};
int main(){
printf("%d %d %d\n", a1.x, a1.y[0], a1.y[1] );
return 0;
}
henry@zulu:~/test> gcc t3.c -Wall
t3.c:6: internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
-----------------------------------------------------------------------
henry@zulu:~/test> gcc -v
Reading specs from /usr/lib/gcc-lib/powerpc-suse-linux/3.2.2/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man
--libdir=/usr/lib --enable-languages=c,c++,f77,objc,java,ada --enable-libgcj
--with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib
--enable-shared --enable-__cxa_atexit powerpc-suse-linux
Thread model: posix
gcc version 3.2.2
--
Summary: segfault when initializing a flexible array member using
designated initializer
Product: gcc
Version: 3.2.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: henryhack101 at netscape dot net
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14714
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/14714] segfault when initializing a flexible array member using designated initializer
2004-03-24 7:42 [Bug c/14714] New: segfault when initializing a flexible array member using designated initializer henryhack101 at netscape dot net
@ 2004-03-24 7:49 ` henryhack101 at netscape dot net
2004-03-24 15:49 ` bangerth at dealii dot org
2004-03-24 16:54 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: henryhack101 at netscape dot net @ 2004-03-24 7:49 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From henryhack101 at netscape dot net 2004-03-24 07:49 -------
It seems I can designate the first element of the array though.
struct A a1 = {1,{[0]=2}};
--
What |Removed |Added
----------------------------------------------------------------------------
Summary|segfault when initializing a|segfault when initializing a
|flexible array member using |flexible array member using
|designated initializer |designated initializer
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14714
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/14714] segfault when initializing a flexible array member using designated initializer
2004-03-24 7:42 [Bug c/14714] New: segfault when initializing a flexible array member using designated initializer henryhack101 at netscape dot net
2004-03-24 7:49 ` [Bug c/14714] " henryhack101 at netscape dot net
@ 2004-03-24 15:49 ` bangerth at dealii dot org
2004-03-24 16:54 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: bangerth at dealii dot org @ 2004-03-24 15:49 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-03-24 15:49 -------
Confirmed, we get an ICE for 3.3 and later:
g/x> /home/bangerth/bin/gcc-3.3.4-pre/bin/gcc -std=c99 -c x.c
x.c:6: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/gcc -std=c99 -c x.c
x.c:6: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
g/x> /home/bangerth/bin/gcc-3.5-pre/bin/gcc -std=c99 -c x.c
x.c:6: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
I assume the code is valid but undefined, since icc gives a warning
like so:
g/x> icc -Xc -ansi -c x.c
x.c(6): warning #1368: excess initializers are ignored
struct A a1 = {1,{[1]=2}};
^
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |ice-on-valid-code
Known to fail| |3.3.3 3.4.0 3.5.0
Last reconfirmed|0000-00-00 00:00:00 |2004-03-24 15:49:18
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14714
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/14714] segfault when initializing a flexible array member using designated initializer
2004-03-24 7:42 [Bug c/14714] New: segfault when initializing a flexible array member using designated initializer henryhack101 at netscape dot net
2004-03-24 7:49 ` [Bug c/14714] " henryhack101 at netscape dot net
2004-03-24 15:49 ` bangerth at dealii dot org
@ 2004-03-24 16:54 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-24 16:54 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-24 16:53 -------
This is a dup of bug 11527.
*** This bug has been marked as a duplicate of 11527 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14714
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-03-24 16:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-24 7:42 [Bug c/14714] New: segfault when initializing a flexible array member using designated initializer henryhack101 at netscape dot net
2004-03-24 7:49 ` [Bug c/14714] " henryhack101 at netscape dot net
2004-03-24 15:49 ` bangerth at dealii dot org
2004-03-24 16:54 ` pinskia at gcc dot gnu dot org
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).