When compiling a software product that my company is working on, I made a typo in curly brace placement when defining an array of structures. The following code crashes GCC when it attempts to compile the code: //************BEGIN************* XML_ALIAS alias[] = { /**** STRING aliases ****/ { name: "STRING", id: 1 }, { name: "TEXT", id: 1 }, { name: "LITERAL", id: 1 }, /**** INTEGER aliases ****/ { name: "INT", id: 2 }, name: "INTEGER", id: 2 }, /*--- This is the line that GCC dies on, #63 ---*/ { name: "NUM", id: 2 }, { name: "NUMBER", id: 2 }, { name: "LONG", id: 2 }, /**** BOOLEAN aliases ****/ { name: "BOOL", id: 3 }, { name: "BOOLEAN", id: 3 }, { name: "BIT", id: 3 }, { name: "BINARY", id: 3 }, /**** FLOATING POINT aliases ****/ { name: "FLOAT", id: 4 }, { name: "DOUBLE", id: 4 }, { name: "REAL" id: 4 }, {NULL, 0} }; //******************END******************* The definition for the structure, by the way, is: struct XML_ALIAS { char *name; int id; }; Reproducible: Always Steps to Reproduce: 1. Try to compile code with screwed up curly brace order as shown above 2. Um... Watch it crash 3. (I would say "PROFIT!!!" here, but I am sure that is done all the time) Actual Results: I get the following GCC error: Compiling loadflatfile.cpp... loadflatfile.cpp:63: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://bugs.gentoo.org/> for instructions. Preprocessed source stored into /tmp/cciTdhMd.out file, please attach this to your bugreport Expected Results: The compiler should point out that the programmer screwed up with a sane error message. gcc (GCC) 3.3.2 20031218 (Gentoo Linux 3.3.2-r5, propolice-3.3-7) sivar@sheridan icsd $ emerge info Portage 2.0.50-r1 (default-x86-1.4, gcc-3.3.2, glibc-2.3.2-r9, 2.6.3) ================================================================= System uname: 2.6.3 i686 AMD Athlon(tm) XP 1800+ Gentoo Base System version 1.4.3.13 distcc 2.12.1 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled] Autoconf: sys-devel/autoconf-2.58-r1 Automake: sys-devel/automake-1.7.7 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-march=athlon -O2 -fomit-frame-pointer -pipe" CHOST="i686-pc-linux-gnu" COMPILER="gcc3" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/qmail/alias /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-march=athlon -O2 -fomit-frame-pointer -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache sandbox userpriv" GENTOO_MIRRORS="http://gentoo.oregonstate.edu http://distro.ibiblio.org/pub/Linux/distributions/gentoo" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="apache2 apm arts avi berkdb crypt encode foomaticdb gdbm gif gpm imlib java jpeg libg++ libwww mad mikmod mpeg mysql ncurses nls oggvorbis pam pdflib perl png postgres python qt quicktime readline sdl slang spell ssl svga tcpd truetype x86 xml2 xv zlib"
Have you tried any of the other gcc versions in the portage tree?
I just tried it with GCC 3.3.3 20040217 for AMD64. It, too, segfaults.
This seems like an UPSTREAM bug to me.
That's what I figured, but apparently we are supposed to report to Gentoo first. I made a GCC error report with a test case and more details at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15018
Fixed in 3.4