Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 46666 - GCC 3.3.2-r5 segfaults on improper curly brace placement
Summary: GCC 3.3.2-r5 segfaults on improper curly brace placement
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL: http://gcc.gnu.org/bugzilla/show_bug....
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-03 00:08 UTC by Charles N. Burns
Modified: 2004-04-19 19:50 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Charles N. Burns 2004-04-03 00:08:28 UTC
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"
Comment 1 Aron Griffis (RETIRED) gentoo-dev 2004-04-04 20:52:05 UTC
Have you tried any of the other gcc versions in the portage tree?
Comment 2 Charles N. Burns 2004-04-06 01:45:14 UTC
I just tried it with GCC 3.3.3 20040217 for AMD64. It, too, segfaults.
Comment 3 solar (RETIRED) gentoo-dev 2004-04-19 01:59:44 UTC
This seems like an UPSTREAM bug to me.
Comment 4 Charles N. Burns 2004-04-19 19:30:00 UTC
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
Comment 5 Charles N. Burns 2004-04-19 19:50:42 UTC
Fixed in 3.4