Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 201605 - [4.1/ICE] when compiling complex template code with -O1
Summary: [4.1/ICE] when compiling complex template code with -O1
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-07 20:19 UTC by Luis Fernando Schultz Xavier da Silveira
Modified: 2009-04-20 17:15 UTC (History)
0 users

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


Attachments
preprocessed source code which causes gcc to fail (ccTE2str.out,370.79 KB, text/plain)
2007-12-07 20:20 UTC, Luis Fernando Schultz Xavier da Silveira
Details
reduced test case (ice.ii,176 bytes, text/plain)
2007-12-08 03:05 UTC, SpanKY
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luis Fernando Schultz Xavier da Silveira 2007-12-07 20:19:03 UTC
I am writing a metaprogramming C++ library in order to learn more about templates.

The main purpose of it is taking the great (congrats to the developers) capacity of abstraction handling of gcc 4.1.2 to its limit, so writing very high level efficient code is possible.

I was profiling a piece of the library with many optimisations turned on when gcc crashed and invited me to fill this bug report.

Turning off the optimisations solves the problem. Further tries show that going from -O0 to -O1 is the culprit.

I have not tried to experiment with the code much.

This is certainly a bug in gcc because I assume no matter the input code gcc takes, it should never crash. Also, I checked for memory comsumption, and gcc did not use considerable memory.

This is it. Hope I helped.

(just leaving a thank you for the marvelous free software compiler gcc is)

Reproducible: Always

Steps to Reproduce:
0. $ g++ -I.. t.c++ -o t -march=pentium-m -O2 -pipe -fomit-frame-pointer

The .. directory is the directory in which the library sources are.

I am sending a preprocessed code.

Actual Results:  
$ g++ -I.. t.c++ -o t -march=pentium-m -O2 -pipe -fomit-frame-pointer
t.c++: In function 'void dosch()':
t.c++:14: 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/ccTE2str.out file, please attach this to your bugreport.


Expected Results:  
it should have either compiled my code or raised compilation errors

using gentoo GNU/Linux on a pentium centrino HP ze4900 laptop

---- emerge --info  output ----
Portage 2.1.3.19 (default-linux/x86/2007.0, gcc-4.1.2, glibc-2.6.1-r0, 2.6.22-suspend2-r2 i686)
=================================================================
System uname: 2.6.22-suspend2-r2 i686 Intel(R) Pentium(R) M processor 1.50GHz
Timestamp of tree: Mon, 03 Dec 2007 00:00:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p17
dev-lang/python:     2.4.4-r6
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 1.12.9-r2
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.22-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i486-pc-linux-gnu"
CFLAGS="-march=pentium-m -O2 -pipe"
CHOST="i486-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/splash /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-march=pentium-m -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://www.las.ic.unicamp.br/pub/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac aalib acl acpi alsa amrnb amrwb ares arts artswrappersuid bash-completion berkdb bidi binary bitmap-fonts bl branding bzip2 cairo cdparanoia cjk cli cracklib crypt cscope cups d dbus dga directfb djvu dri dts dv dvd enca encode expat fbcon fftw flac fontconfig fortran gd gdbm ggi gif glib gmp gnutls gpm graphviz gs gtk guile hal hddtemp hpn iconv idea idn ieee1394 imlib ipv6 isdnlog javascript joystick jpeg jpeg2k kde kdehiddenvisibility kerberos krb4 lame lapack latex lcms ldap libcaca libedit libsamplerate lzo mad md5sum midi mikmod mmap mmx mng motif mp2 mp3 mpeg mudflap musepack ncurses nemesi nls nptl nptlonly objc objc++ objc-gc ocaml offensive ogg openal openexr opengl openmp pam pch pcmcia pcre pdf perl plotutils png pppd pulseaudio python qt3 qt4 quicktime readline reflection rtc ruby sdl session slang sndfile speex spell spl sse sse2 ssl svg svga tcl tcpd tetex tga theora threads tiff tk truetype truetype-fonts type1-fonts unicode vidix vim-pager vim-syntax vim-with-x vorbis vorbis-psy win32codecs wmf wxwindows x86 xanim xml xorg xpm xscreensaver xv xvid xvmc zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse synaptics evdev joystick" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="i810"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 1 Luis Fernando Schultz Xavier da Silveira 2007-12-07 20:20:37 UTC
Created attachment 137971 [details]
preprocessed source code which causes gcc to fail
Comment 2 SpanKY gentoo-dev 2007-12-08 03:05:52 UTC
Created attachment 137988 [details]
reduced test case

looks like this is already fixed in gcc-4.2.x
Comment 3 Mark Loeser (RETIRED) gentoo-dev 2009-04-20 17:15:33 UTC
Fixed in gcc-4.3