sys-devel/gcc-4.6.2 can compile sys-libs/boost-1.48.0 but not -1.49.0. I saw the same bug show up on the boost mailing list with no response, also with gcc-4.6.2 <http://lists.boost.org/Archives/boost/2012/01/189993.php>. Probably it would compile with USE=-tools. The error (also see attached build.log): gcc.compile.c++ ../bin.v2/tools/quickbook/src/gcc-4.6/release/link-static/pch-off/id_manager.o "x86_64-pc-linux-gnu-g++" -ftemplate-depth-300 -O2 -pipe -march=amdfam10 -O3 -finline-functions -Wno-inline -Wall -g0 -DBOOST_ALL_NO_LIB=1 -DBOOST_FILESYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1 -DNDEBUG -I".." -c -o "../bin.v2/tools/quickbook/src/gcc-4.6/release/link-static/pch-off/id_manager.o" "quickbook/src/id_manager.cpp" In file included from ../boost/intrusive_ptr.hpp:16:0, from quickbook/src/fwd.hpp:15, from quickbook/src/values.hpp:20, from quickbook/src/id_manager.hpp:14, from quickbook/src/id_manager.cpp:9: ../boost/smart_ptr/intrusive_ptr.hpp: In destructor ‘boost::intrusive_ptr<T>::~intrusive_ptr() [with T = quickbook::file_info]’: ../boost/smart_ptr/intrusive_ptr.hpp:94:5: internal compiler error: Segmentation fault Portage 2.2.0_alpha100 (default/linux/amd64/10.0/desktop, gcc-4.6.2, glibc-2.13-r4, 3.3.0-gentoo x86_64) ================================================================= System uname: Linux-3.3.0-gentoo-x86_64-AMD_Phenom-tm-_II_X4_955_Processor-with-gentoo-2.1 Timestamp of tree: Thu, 12 Apr 2012 04:15:01 +0000 app-shells/bash: 4.2_p20 dev-java/java-config: 2.1.11-r3 dev-lang/python: 2.7.2-r3, 3.2.2-r1 dev-util/cmake: 2.8.6-r4 dev-util/pkgconfig: 0.26 sys-apps/baselayout: 2.1 sys-apps/openrc: 0.9.9.3 sys-apps/sandbox: 2.5 sys-devel/autoconf: 2.13, 2.68 sys-devel/automake: 1.9.6-r3, 1.10.3, 1.11.1 sys-devel/binutils: 2.21.1-r1 sys-devel/gcc: 4.6.2 sys-devel/gcc-config: 1.5-r2 sys-devel/libtool: 2.4-r1 sys-devel/make: 3.82-r1 sys-kernel/linux-headers: 3.1 (virtual/os-headers) sys-libs/glibc: 2.13-r4 Repositories: gentoo perl-experimental enlightenment galadriel Installed sets: @enlightenment-live, @enlightenment-modules ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="* -@EULA AdobeFlash-10 AdobeFlash-10.1 PUEL" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -pipe -march=amdfam10" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /var/lib/hsqldb" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /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 -march=amdfam10" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--with-bdeps y" FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersync xattr" FFLAGS="" GENTOO_MIRRORS=" http://gentoo.osuosl.org/ http://gentoo.mirrors.tds.net/gentoo" LANG="en_US.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" LINGUAS="de de_DE en en_US nb nb_NO no" MAKEOPTS="-j5" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --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/perl-experimental /var/lib/layman/enlightenment /usr/local/portage" SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage" USE="3dnow X a52 aac aalib acl acpi afs alsa amd64 arts bash-completion berkdb branding bzip2 cairo caps cdda cddb cdparanoia cdr cli consolekit cracklib crypt css cups curl cvs cxx dbus dga directfb dri dts dvd dvdr eds emboss encode exif expat fam fbcon ffmpeg firefox flac fontconfig fortran ftp gcj gd gdu geoip ggi gif gpm gstreamer gtk iconv icu imagemagick imap ipod ipv6 java jpeg jpeg2k kde kerberos ladspa lame lapack latex lcms ldap libedit libnotify lzma lzo mad maildir mbox mms mmx mng modules motroska mp3 mp4 mpeg mpi mplayer mtp mudflap multilib musepack musicbrainz nas ncurses networkmanager nls nntp nptl nptlonly offensive ogg openal openexr opengl openmp pam pango pcre pdf perl plotutils png policykit portaudio postgres ppds pppd python qt3support qt4 quicktime readline samba sasl sdl semantic-desktop session smp speex spell sse sse2 ssl startup-notification static-libs subversion svg sysfs syslog taglib tcpd theora threads tiff truetype udev unicode usb vim-syntax vorbis wavpack wifi wmf wxwidgets x264 xattr xcb xcomposite xft xine xinetd xml xorg xosd xpm xulrunner xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci 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 mmap_emul 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 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" 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 keyboard joystick mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de de_DE en en_US nb nb_NO no" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fglrx r700 radeon" 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, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Created attachment 308627 [details] build.log.bz2
does it fail at the same place every time ? what if you turn off -pipe ? if so, go into the build dir and run: x86_64-pc-linux-gnu-g++ -ftemplate-depth-300 -O2 -pipe -march=amdfam10 -O3 \ -finline-functions -Wno-inline -Wall -g0 -DBOOST_ALL_NO_LIB=1 \ -DBOOST_FILESYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1 \ -DNDEBUG -I.. -E -o id_manager.i quickbook/src/id_manager.cpp then compress & post the id_manager.i file
Created attachment 308851 [details] preprocessed id_manager.cpp I tried removing -pipe and got the same error. I also changed -march=amdfam10 to -march=native and got the same error (I don't know how I never changed that). I don't know if I can reopen the bug. For reference, the destructor is on line 40500 of id_manager.i.
Created attachment 308855 [details] id_manager.cpp preprocessed *without* -DNDEBUG I played around with the command, and it compiles if I change -O3 to -O[01s] or if I remove -DNDEBUG. I found that in tools/quickbook/src/intrusive_base.hpp, quickbook::intrusive_base<T> (parent class of quickbook::file_info) has the destructor: ~intrusive_base() { assert(!ref_count_); } Which would be inlined into intrusive_ptr_release(T*), and in turn inlined into intrusive_ptr::~intrusive_ptr(). The -UNDEBUG version looks like this (indented for readability): ~intrusive_base() { ((!ref_count_) ? static_cast<void>(0) : __assert_fail("!ref_count_", "quickbook/src/intrusive_base.hpp", 24, __PRETTY_FUNCTION__)); } Strangely enough, I got it to compile by: --- boost_1_49_0/tools/quickbook/src/intrusive_base.hpp.orig 2012-04-14 00:26:49.360818878 -0700 +++ boost_1_49_0/tools/quickbook/src/intrusive_base.hpp 2012-04-14 00:27:10.214279871 -0700 @@ -21,7 +21,7 @@ intrusive_base() : ref_count_(0) {} intrusive_base(intrusive_base const&) : ref_count_(0) {} intrusive_base& operator=(intrusive_base const&) { return *this; } - ~intrusive_base() { assert(!ref_count_); } + ~intrusive_base() { ref_count_ = 0; } friend void intrusive_ptr_add_ref(T* ptr) { ++ptr->ref_count_; } Okay, definitely a GCC bug.
Here's the real fix: --- boost_1_49_0/tools/quickbook/src/intrusive_base.hpp.orig 2012-04-14 00:26:49.360818878 -0700 +++ boost_1_49_0/tools/quickbook/src/intrusive_base.hpp 2012-04-14 00:27:10.214279871 -0700 @@ -21,7 +21,7 @@ intrusive_base() : ref_count_(0) {} intrusive_base(intrusive_base const&) : ref_count_(0) {} intrusive_base& operator=(intrusive_base const&) { return *this; } - ~intrusive_base() { assert(!ref_count_); } + virtual ~intrusive_base() { assert(!ref_count_); } friend void intrusive_ptr_add_ref(T* ptr) { ++ptr->ref_count_; } ALWAYS make destructors virtual, unless you really don't like OOP. So it's both a Boost bug and a GCC bug. I am so proud of myself right now :) Enough excitement for me, I need to get about six hours of sleep now.
please clone this bug to start a new one for the boost people. or just file the issue upstream ;).
Created attachment 308979 [details] reduced test case $ g++-4.6.2 -pipe -c -O2 -o /dev/null id_manager.i id_manager.i: In destructor ‘intrusive_ptr<T>::~intrusive_ptr() [with T = si]’: id_manager.i:34:14: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <http://bugs.gentoo.org/> for instructions.
Debian's gcc-4.6.3 builds this code just fine. so we'll wait until 4.6.3 is in the tree to retest.
Cloned to bug 412155. The upstream Boost bug is https://svn.boost.org/trac/boost/ticket/6794 . They don't plan to fix it since they're going to factor out the intrusive_base class.
*** Bug 415247 has been marked as a duplicate of this bug. ***
this might be related too http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51737
(In reply to comment #8) > Debian's gcc-4.6.3 builds this code just fine. so we'll wait until 4.6.3 is > in the tree to retest. Fixed in 4.7 branch, not backported to 4.6. http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172023 Orignal PR[1] is not related to ICE [1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47663
Fixed in 4.6.4.