This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/14714] New: segfault when initializing a flexible array member using designated initializer
- From: "henryhack101 at netscape dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Mar 2004 07:42:56 -0000
- Subject: [Bug c/14714] New: segfault when initializing a flexible array member using designated initializer
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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