Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 52654 - GCC: internal compiler error (while compiling simple example)
Summary: GCC: internal compiler error (while compiling simple example)
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High blocker (vote)
Assignee: Gentoo Toolchain Maintainers
URL: http://nostdal.net/paste/98e00229c50c...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-31 22:19 UTC by Lars Rune Nøstdal
Modified: 2004-06-01 07:53 UTC (History)
0 users

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


Attachments
This is the preprocessed source. (cc7CwBiG.out,697.38 KB, text/plain)
2004-05-31 22:21 UTC, Lars Rune Nøstdal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Rune Nøstdal 2004-05-31 22:19:10 UTC
This is the code:
http://nostdal.net/paste/98e00229c50cdd37fa260737c3625296.html

I've tried this with gcc 3.3.3 also:
# g++ --version
g++ (GCC) 3.3.3 20040217 (Gentoo Linux 3.3.3, propolice-3.3-7)
..with the same results.

Also the same results with Dev-C++ (MinGW/GCC 3.2?) under Windows on the machine of a friend of mine.

I'll attach the preprocessed source in a moment.

Reproducible: Always
Steps to Reproduce:
1. I compile the code i link too, like this:

g++ a.cpp -o a

Actual Results:  
a.cpp: In function `int main()':
a.cpp:43: internal compiler error: Segmentation fault

Expected Results:  
Not crashed.

emerge info:
Portage 2.0.50-r7 (default-x86-1.4, gcc-3.4.0, glibc-2.3.3_pre20040420-r0,
2.6.5-gentoo-r1)
=================================================================
System uname: 2.6.5-gentoo-r1 i686 AMD Athlon(tm) XP 2600+
Gentoo Base System version 1.4.15
distcc 2.14 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
Autoconf: sys-devel/autoconf-2.59-r4
Automake: sys-devel/automake-1.8.5
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-march=athlon-xp -O3 -pipe -ffast-math -ftracer -funroll-loops
-funswitch-loops -fpeel-loops -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config
/usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/
/usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/
/usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=athlon-xp -O3 -pipe -ffast-math -ftracer -funroll-loops
-funswitch-loops -fpeel-loops -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="ftp://ftp.du.se/pub/os/gentoo http://ftp.du.se/pub/os/gentoo
http://ds.thn.htu.se/linux/gentoo http://mirror.pudas.net/gentoo
ftp://mirror.pudas.net/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X alsa apm avi berkdb bonobo cdr crypt cups encode esd foomaticdb gdbm gif
gnome gpm gtk gtk2 gtkhtml guile imlib jpeg ldap libg++ libwww mad mikmod motif
mozilla mpeg ncurses nls oggvorbis opengl oss pam pdflib perl png python
quicktime readline sdl slang spell ssl svga tcltk tcpd tetex truetype x86 xml2
xmms xv zlib"
Comment 1 Lars Rune Nøstdal 2004-05-31 22:21:08 UTC
Created attachment 32432 [details]
This is the preprocessed source.
Comment 2 Lars Rune Nøstdal 2004-05-31 23:05:44 UTC
This seems to work:
http://nostdal.net/paste/b53b339adb212d0f1a4f6e2ec61e880c.html

But still this might be a bug in GCC, since the first code i pasted works in Comeau's online-compiler (it also works in the old VC++6.0-compiler by the way).
Comment 3 Lars Rune Nøstdal 2004-06-01 01:26:57 UTC
I've made the code a bit shorter, here:


int defValue()
{
	return(0);								
}


int(*defaultValue)() = defValue;


class A {
public:
	A(int value_ = defaultValue())
	{		
	} 
};


int main()
{
	A a;
	return(0);
}


Should probably have done this in the first place.
Comment 4 Andrew Ross (RETIRED) gentoo-dev 2004-06-01 01:44:44 UTC
I can reproduce the error, using the code contained at the URL.

g++ --version
g++ (GCC) 3.3.2 20031218 (Gentoo Linux 3.3.2-r5, propolice-3.3-7)


Comment 5 Lars Rune Nøstdal 2004-06-01 02:04:49 UTC
Ok, I've narrowed it down even more:


int defValue() { return(0); }
int(*defaultValue)() = defValue;

void a(int blah = defaultValue()) {}

int main() { a(); }


And a friend of mine tried:
2.95.3, 3.0.4, 3.1 and 3.2.3.
..all crash.

I've decided to file a report to the GCC-maintainers.
Comment 6 Lars Rune Nøstdal 2004-06-01 05:27:47 UTC
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15759

I've resolved this bug and set the resolution to "UPSTREAM", hope this is correct; I'm kinda new with this Bugzilla. :)
Comment 7 Travis Tilley (RETIRED) gentoo-dev 2004-06-01 07:46:28 UTC
try adding -fno-unit-at-a-time. if that fixes things, this is a known bug that's being worked on... and a major headache for me :/
Comment 8 Lars Rune Nøstdal 2004-06-01 07:53:19 UTC
$ g++ -fno-unit-at-a-time a.cpp -o a
a.cpp: In function `int main()':
a.cpp:7: internal compiler error: Segmentation fault

Nope, doesn't work.

Isn't this option rather new? This bug has existed since 2.95.