http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58336
Bug ID: 58336 Summary: internal compiler error when using a static int for the size of a char array within a class Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: holger.brunck at keymile dot com Hi, I hit a compiler error when compiling the following code with g++ 4.7.2: static int b = 5; class A { public : A(); }; A::A() { char c[b]; } ------------------------------------------------------ This compilation example is with a powerpc cross compiler, but a x86 compiler shows the same result. powerpc-gcc -v -save-temps -g -c file.cpp Using built-in specs. COLLECT_GCC=powerpc-gcc Target: powerpc-linux Configured with: /opt/eldk/build/eldk-rel-v5.4-2013-08-02-9a46fd5-powerpc/tmp/work-shared/gcc-4.7.2-r20/gcc-4.7.2/configure --build=x86_64-linux --host=i686-eldk-linux --target=powerpc-linux --prefix=/opt/eldk-5.4/powerpc/sysroots/i686-eldk-linux/usr --exec_prefix=/opt/eldk-5.4/powerpc/sysroots/i686-eldk-linux/usr --bindir=/opt/eldk-5.4/powerpc/sysroots/i686-eldk-linux/usr/bin/powerpc-linux --sbindir=/opt/eldk-5.4/powerpc/sysroots/i686-eldk-linux/usr/bin/powerpc-linux --libexecdir=/opt/eldk-5.4/powerpc/sysroots/i686-eldk-linux/usr/libexec/powerpc-linux --datadir=/opt/eldk-5.4/powerpc/sysroots/i686-eldk-linux/usr/share --sysconfdir=/opt/eldk-5.4/powerpc/sysroots/i686-eldk-linux/etc --sharedstatedir=/opt/eldk-5.4/powerpc/sysroots/i686-eldk-linux/com --localstatedir=/opt/eldk-5.4/powerpc/sysroots/i686-eldk-linux/var --libdir=/opt/eldk-5.4/powerpc/sysroots/i686-eldk-linux/usr/lib/powerpc-linux --includedir=/opt/eldk-5.4/powerpc/sysroots/i686-eldk-linux/usr/include --oldincludedir=/opt/eldk-5.4/powerpc/sysroots/i686-eldk-linux/usr/include --infodir=/opt/eldk-5.4/powerpc/sysroots/i686-eldk-linux/usr/share/info --mandir=/opt/eldk-5.4/powerpc/sysroots/i686-eldk-linux/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/opt/eldk/build/eldk-rel-v5.4-2013-08-02-9a46fd5-powerpc/tmp/sysroots/i686-nativesdk-eldk-linux --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --disable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=powerpc-linux- --without-local-prefix --enable-lto --enable-libssp --disable-bootstrap --disable-libmudflap --with-system-zlib --with-linker-hash-style=gnu --enable-linker-build-id --with-ppl=no --with-cloog=no --enable-checking=release --enable-cheaders=c_global --with-gxx-include-dir=/opt/eldk-5.4/powerpc/sysroots/powerpc-linux/usr/include/c++ --with-build-time-tools=/opt/eldk/build/eldk-rel-v5.4-2013-08-02-9a46fd5-powerpc/tmp/sysroots/x86_64-linux/usr/powerpc-linux/bin --with-sysroot=/opt/eldk-5.4/powerpc/sysroots/powerpc-linux --with-build-sysroot=/opt/eldk/build/eldk-rel-v5.4-2013-08-02-9a46fd5-powerpc/tmp/sysroots/generic-powerpc --disable-libunwind-exceptions --disable-libssp --disable-libgomp --disable-libmudflap --with-mpfr=/opt/eldk/build/eldk-rel-v5.4-2013-08-02-9a46fd5-powerpc/tmp/sysroots/i686-nativesdk-eldk-linux --with-mpc=/opt/eldk/build/eldk-rel-v5.4-2013-08-02-9a46fd5-powerpc/tmp/sysroots/i686-nativesdk-eldk-linux --enable-nls --enable-__cxa_atexit --with-long-double-128 Thread model: posix gcc version 4.7.2 (GCC) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-g' '-c' /opt/keymile/ELDK/eldk_5_4-km.git/powerpc/sysroots/i686-eldk-linux/usr/bin/powerpc-linux/../../libexec/powerpc-linux/gcc/powerpc-linux/4.7.2/cc1plus -E -quiet -v -iprefix /opt/keymile/ELDK/eldk_5_4-km.git/powerpc/sysroots/i686-eldk-linux/usr/bin/powerpc-linux/../../lib/powerpc-linux/gcc/powerpc-linux/4.7.2/ -D_GNU_SOURCE -D__unix__ -D__gnu_linux__ -D__linux__ -Dunix -D__unix -Dlinux -D__linux -Asystem=linux -Asystem=unix -Asystem=posix file.cpp -g -fworking-directory -fpch-preprocess -o file.ii ignoring nonexistent directory "/opt/keymile/ELDK/eldk_5_4-km.git/powerpc/sysroots/i686-eldk-linux/usr/bin/powerpc-linux/../../lib/powerpc-linux/gcc/powerpc-linux/4.7.2/../../../../../powerpc-linux/include" ignoring duplicate directory "/opt/keymile/ELDK/eldk_5_4-km.git/powerpc/sysroots/i686-eldk-linux/usr/bin/powerpc-linux/../../lib/powerpc-linux/gcc/../../../lib/powerpc-linux/gcc/powerpc-linux/4.7.2/include" ignoring duplicate directory "/opt/keymile/ELDK/eldk_5_4-km.git/powerpc/sysroots/i686-eldk-linux/usr/bin/powerpc-linux/../../lib/powerpc-linux/gcc/../../../lib/powerpc-linux/gcc/powerpc-linux/4.7.2/include-fixed" ignoring nonexistent directory "/opt/keymile/ELDK/eldk_5_4-km.git/powerpc/sysroots/i686-eldk-linux/usr/bin/powerpc-linux/../../lib/powerpc-linux/gcc/../../../lib/powerpc-linux/gcc/powerpc-linux/4.7.2/../../../../../powerpc-linux/include" #include "..." search starts here: #include <...> search starts here: /opt/keymile/ELDK/eldk_5_4-km.git/powerpc/sysroots/i686-eldk-linux/usr/bin/powerpc-linux/../../lib/powerpc-linux/gcc/powerpc-linux/4.7.2/include /opt/keymile/ELDK/eldk_5_4-km.git/powerpc/sysroots/i686-eldk-linux/usr/bin/powerpc-linux/../../lib/powerpc-linux/gcc/powerpc-linux/4.7.2/include-fixed /opt/eldk-5.4/powerpc/sysroots/powerpc-linux/usr/include/c++ /opt/eldk-5.4/powerpc/sysroots/powerpc-linux/usr/include/c++/powerpc-linux /opt/eldk-5.4/powerpc/sysroots/powerpc-linux/usr/include/c++/backward /opt/eldk-5.4/powerpc/sysroots/powerpc-linux/usr/local/include /opt/eldk-5.4/powerpc/sysroots/powerpc-linux/usr/include End of search list. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-g' '-c' /opt/keymile/ELDK/eldk_5_4-km.git/powerpc/sysroots/i686-eldk-linux/usr/bin/powerpc-linux/../../libexec/powerpc-linux/gcc/powerpc-linux/4.7.2/cc1plus -fpreprocessed file.ii -quiet -dumpbase file.cpp -auxbase file -g -version -o file.s GNU C++ (GCC) version 4.7.2 (powerpc-linux) compiled by GNU C version 4.7.2, GMP version 5.1.0, MPFR version 3.1.1, MPC version 0.8.2 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C++ (GCC) version 4.7.2 (powerpc-linux) compiled by GNU C version 4.7.2, GMP version 5.1.0, MPFR version 3.1.1, MPC version 0.8.2 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 5729b3532d48628ac91bacce44c8a59d file.cpp: In constructor 'A::A()': file.cpp:11:1: internal compiler error: Segmentation fault