Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 487010 (PR58639) - [4.6/4.7/4.8] internal compiler error: Segmentation fault (cc1plus) on self-referential struct member
Summary: [4.6/4.7/4.8] internal compiler error: Segmentation fault (cc1plus) on self-r...
Status: RESOLVED UPSTREAM
Alias: PR58639
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL: http://gcc.gnu.org/PR58639
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-05 13:41 UTC by Jeremy Murphy
Modified: 2014-01-28 04:58 UTC (History)
1 user (show)

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 Jeremy Murphy 2013-10-05 13:41:39 UTC
Well, this ICE should amuse fans of Douglas Hofstadter: segmentation fault when failing to initialize self-referential struct member.  (Which is impossible to initialize anyway, right?)  The code is very small, so here it is:

#include <vector>

struct node
{
    node &parent;
};

void f()
{
    std::vector<node> v;
    v.push_back({});
}

It's worth noting that if the initialize is simple, ie:
node foo = {};
then it won't segfault.  There is something necessary in the matching of the function that causes it.  A reference to a different type did not segfault, only self-referential.
If you compile it in C++98 mode then you get more output and a hint as to what is going wrong.  This line:

test.cpp:13:19: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]

repeated 167,737 times.


Reproducible: Always

Steps to Reproduce:
1. Compile the above C++ code.

Actual Results:  
g++-4.8: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugs.gentoo.org/> for instructions.


Expected Results:  
test.cpp: In function ‘void f()’:
test.cpp:11:17: error: uninitialized const member ‘node::parent’


Portage 2.2.1 (default/linux/amd64/13.0/desktop/kde, gcc-4.7.3, glibc-2.15-r3, 3.11.1-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.11.1-gentoo-x86_64-Intel-R-_Core-TM-_i5_CPU_M_580_@_2.67GHz-with-gentoo-2.2
KiB Mem:     7954132 total,   1224052 free
KiB Swap:    4095996 total,   3892632 free
Timestamp of tree: Fri, 04 Oct 2013 22:15:01 +0000
ld GNU ld (GNU Binutils) 2.23.1
app-shells/bash:          4.2_p45
dev-java/java-config:     2.1.12-r1
dev-lang/python:          2.7.5-r2, 3.2.5-r2
dev-util/cmake:           2.8.10.2-r2
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.11.6, 1.12.6, 1.13.4
sys-devel/binutils:       2.23.1
sys-devel/gcc:            4.7.3, 4.8.1
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.9 (virtual/os-headers)
sys-libs/glibc:           2.15-r3
Repositories: gentoo x11 seden sunrise dmol kde lisp mv java science local
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA Google-TOS google-talkplugin google-chrome FAH-EULA-2009 skype-4.0.0.7-copyright"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -w -march=native"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0 /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -w -march=native"
DISTDIR="/var/tmp/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch parallel-install preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://ftp.iinet.net.au/pub/Gentoo http://ftp.swin.edu.au/gentoo"
LANG="en_AU.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4"
PKGDIR="/var/tmp/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/x11 /var/lib/layman/seden /var/lib/layman/sunrise /var/lib/layman/dmol /var/lib/layman/kde /var/lib/layman/lisp /var/lib/layman/mv /var/lib/layman/java /var/lib/layman/science /usr/local/portage"
SYNC="rsync://rsync.au.gentoo.org/gentoo-portage"
USE="X a52 aac aalib acl acpi alsa amd64 ao avahi bash-completion berkdb blas bluetooth branding bzip2 c++0x cairo caps cdda cddb cli consolekit cracklib crypt css cups curl cxx dbus declarative djvu dri dts dv dvd dvdr emboss encode exif expat fam ffmpeg fftw flac fontconfig fortran gd gdbm geoip gif gmp gnuplot gnutls gphoto2 gpm graphviz gsl gsm gtk iconv icu idn ieee1394 imagemagick imlib ipod ipv6 java java6 javascript jpeg jpeg2k kde kipi ladspa lame lapack laptop latex lcms ldap libnotify libsamplerate lzma lzo mad matroska mmap mmx mng modules mp3 mp4 mpeg mpi mtp mudflap multilib mysql mysqli ncurses nls nptl nsplugin ntfs offensive ogg openal openexr opengl openmp pam pango pch pcre pdf phonon php plasma plotutils png policykit postscript ppds python qt3support qt4 readline samba scanner sdl semantic-desktop session sharedmem smp sndfile sox speex spell sqlite sqlite3 sse sse2 sse3 ssl startup-notification subversion svg syslog szip taglib tcpd theora threads tiff truetype udev udisks unicode upnp upower usb vcd vnc vorbis wavpack wifi wmf wxwidgets x264 xcb xcomposite xinerama xml xpm xscreensaver xv xvid zeroconf zlib" ABI_X86="64" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd 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 cgi cgid 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" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en_AU en_GB" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" RUBY_TARGETS="ruby19 ruby18" USERLAND="GNU" VIDEO_CARDS="intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

sys-devel/gcc-4.7.3 was built with the following:
USE="cxx fortran graphite gtk lto mudflap (multilib) nls nptl openmp (policykit) (-altivec) -doc (-fixed-point) -gcj -go (-hardened) (-libssp) -multislot -nopie -nossp -objc -objc++ -objc-gc -regression-test -vanilla" ABI_X86="64"
CFLAGS="-march=native -O2 -g -pipe -w"
CXXFLAGS="-march=native -O2 -g -pipe -w"


sys-devel/gcc-4.8.1 was built with the following:
USE="cxx fortran graphite gtk lto mudflap (multilib) nls nptl openmp (policykit) (-altivec) -doc (-fixed-point) -gcj -go (-hardened) (-libssp) -multislot -nopie -nossp -objc -objc++ -objc-gc -regression-test -vanilla" ABI_X86="64"
CFLAGS="-march=native -O2 -g -pipe -w"
CXXFLAGS="-march=native -O2 -g -pipe -w"
Comment 1 Ryan Hill (RETIRED) gentoo-dev 2014-01-28 04:58:30 UTC
Fixed upstream for 4.9.  As this is invalid code I don't think we'll bother backporting it.