http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54363
Bug #: 54363 Summary: ICE when compiling malformed struct initializers Classification: Unclassified Product: gcc Version: 4.7.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: kamar...@gmail.com Created attachment 28076 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28076 preprocessed source code with gcc 4.7.1 This bug is originally reported by Bernhard as http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=684635 The following invalid code triggers an ICE with gcc-4.7 $cat t.c struct bla{char **a;};void test(void){struct bla b = {.a =(char**){"a","b"}};} $gcc -c t.c t.c: In function ‘test’: t.c:1:46: warning: initialization from incompatible pointer type [enabled by default] t.c:1:46: warning: (near initialization for ‘(anonymous)’) [enabled by default] t.c:1:46: warning: excess elements in scalar initializer [enabled by default] t.c:1:46: warning: (near initialization for ‘(anonymous)’) [enabled by default] t.c:1:50: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions. Preprocessed source stored into /tmp/ccS0X8p2.out file, please attach this to your bugreport. Attaching the preprocessed source code as ccS0X8p2.out . I am using $gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/i486-linux-gnu/4.7/lto-wrapper Target: i486-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.1-2' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-targets=all --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu Thread model: posix gcc version 4.7.1 (Debian 4.7.1-2) The same ICE also occurs with gcc version 4.6.2 (Debian 4.6.2-12). But gcc version 4.4.7 (Debian 4.4.7-1) compiles with a warning. $gcc-4.4 -c t.c t.c: In function ‘test’: t.c:1: warning: initialization from incompatible pointer type t.c:1: warning: excess elements in scalar initializer t.c:1: warning: (near initialization for ‘(anonymous)’) $gcc-4.4 -v Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.7-1' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-targets=all --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu Thread model: posix gcc version 4.4.7 (Debian 4.4.7-1)