Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 77130 - GCC 3.4.3 generates bad code for std::list.erase with -O0
Summary: GCC 3.4.3 generates bad code for std::list.erase with -O0
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: x86 Linux
: High major
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-08 04:53 UTC by Pekka Enberg
Modified: 2005-01-23 11:51 UTC (History)
2 users (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 Pekka Enberg 2005-01-08 04:53:50 UTC
I have been investigating the aRts compilation problem [1]. I think the
root cause is that GCC generates bad code for mcopidl in aRts. I narrowed
the error down to a simple test case which is attached to this report.

I tested with the following configurations:

  GCC 3.3.4  -O0  Ok.
  GCC 3.4.3  -O0  Fails with SIGSEGV.
  GCC 3.4.3  -O1  Ok.

This is consistent with the original aRts problem as compiling mcopidl with
-O1 makes the segmentation fault go away.

  1. http://bugs.gentoo.org/show_bug.cgi?id=67926

Test Program
============

#include <list>
#include <string>

using std::list;
using std::string;

static list<string> global;

static void fault()
{
	list<string> local;
	global.push_back("Arts");
	local.push_back("Arts");
	global = local;
}

int main()
{
	fault();
}

GCC 3.4.3 with -O0:
===================

pje ~/devel/gcc 11 gdb a.out
GNU gdb 6.2.1
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) r
Starting program: /home/pje/devel/gcc/a.out

Program received signal SIGSEGV, Segmentation fault.
0x080498c7 in std::list<std::string, std::allocator<std::string> >::erase ()
(gdb) bt
#0  0x080498c7 in std::list<std::string, std::allocator<std::string> >::erase ()
#1  0x0804955b in std::list<std::string, std::allocator<std::string> >::erase ()
#2  0x08048f52 in std::list<std::string, std::allocator<std::string> >::operator= ()
#3  0x08048a3d in fault ()
#4  0x08048ab7 in main ()

emerge info
===========

Gentoo Base System version 1.6.8
Portage 2.0.51-r8 (default-linux/x86/2004.0, gcc-3.4.3, glibc-2.3.4.20041102-r0, 2.6.10-rc3-mm1 i686)
=================================================================
System uname: 2.6.10-rc3-mm1 i686 Intel(R) Celeron(R) CPU 2.80GHz
Python:              dev-lang/python-2.3.4 [2.3.4 (#1, Sep  7 2004, 13:20:27)]
dev-lang/python:     2.3.4
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.5, 1.4_p6, 1.9.3, 1.8.5-r2, 1.6.3, 1.7.9
sys-devel/binutils:  2.15.92.0.2-r2
sys-devel/libtool:   1.5.10-r2
virtual/os-headers:  2.6.8.1-r2
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-O2 -march=pentium3 -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /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="-O2 -march=pentium3 -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/Linux/distributions/gentoo"
LDFLAGS=""
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 X acl adns alsa apm arts avi berkdb bitmap-fonts cdr crypt cscope cups encode esd fam flac foomaticdb fortran gdbm gif gnome gphoto2 gpm gtk gtk2 imagemagick imlib ipv6 jack java jpeg junit kde libwww mad mikmod motif mpeg mysql ncurses nls nptl oggvorbis opengl oss pam pdflib perl png python qt quicktime readline ruby sdl slang spell ssl svga tcltk tcpd tetex tiff truetype xml xml2 xmms xv zlib"
Comment 1 Jeremy Huddleston (RETIRED) gentoo-dev 2005-01-08 15:27:01 UTC
Works for me with 3.4.3-r1.  Can you try that version?

(15:22:55 Sat Jan 08 2004 jeremy@cid i686)
~/tmp $ g++ -O0 failsO0.c
./a.out 
g++ --version

(15:23:17 Sat Jan 08 2004 jeremy@cid i686)
~/tmp $ ./a.out 

(15:23:18 Sat Jan 08 2004 jeremy@cid i686)
~/tmp $ g++ --version
g++ (GCC) 3.4.3 20041125 (Gentoo Linux 3.4.3-r1, ssp-3.4.3-0, pie-8.7.7)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Comment 2 Jeremy Huddleston (RETIRED) gentoo-dev 2005-01-18 01:29:30 UTC
no response.  closing.  Please reopen if you can reproduce.
Comment 3 Matteo Spreafico 2005-01-23 06:59:35 UTC
With gcc-3.4.3-r1 I have the following results:

$ g++ -O1 test.cpp
$ ./a.out


$ g++ -O0 test.cpp
$ ./a.out




$ gcc -O1 test.cpp
/tmp/ccbTf8xN.o(.text+0x4c): In function `fault()':
: undefined reference to `std::allocator<char>::allocator()'
/tmp/ccbTf8xN.o(.text+0x60): In function `fault()':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
/tmp/ccbTf8xN.o(.text+0x8d): In function `fault()':
: undefined reference to `std::allocator<char>::allocator(std::allocator<char> const&)'
/tmp/ccbTf8xN.o(.text+0x93): In function `fault()':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_S_empty_rep_storage'
/tmp/ccbTf8xN.o(.text+0xa8): In function `fault()':
: undefined reference to `__gnu_cxx::__exchange_and_add(int volatile*, int)'
/tmp/ccbTf8xN.o(.text+0xbb): In function `fault()':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_M_destroy(std::allocator<char> const&)'
/tmp/ccbTf8xN.o(.text+0xca): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.text+0xd2): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.text+0xdf): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.text+0xe7): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.text+0x104): In function `fault()':
: undefined reference to `std::allocator<char>::allocator(std::allocator<char> const&)'
/tmp/ccbTf8xN.o(.text+0x10a): In function `fault()':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_S_empty_rep_storage'
/tmp/ccbTf8xN.o(.text+0x11f): In function `fault()':
: undefined reference to `__gnu_cxx::__exchange_and_add(int volatile*, int)'
/tmp/ccbTf8xN.o(.text+0x132): In function `fault()':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_M_destroy(std::allocator<char> const&)'
/tmp/ccbTf8xN.o(.text+0x141): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.text+0x149): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.text+0x158): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.text+0x168): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.text+0x170): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.text+0x17b): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.text+0x183): In function `fault()':
: undefined reference to `std::allocator<char>::allocator()'
/tmp/ccbTf8xN.o(.text+0x197): In function `fault()':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
/tmp/ccbTf8xN.o(.text+0x1c3): In function `fault()':
: undefined reference to `std::allocator<char>::allocator(std::allocator<char> const&)'
/tmp/ccbTf8xN.o(.text+0x1c9): In function `fault()':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_S_empty_rep_storage'
/tmp/ccbTf8xN.o(.text+0x1de): In function `fault()':
: undefined reference to `__gnu_cxx::__exchange_and_add(int volatile*, int)'
/tmp/ccbTf8xN.o(.text+0x1f1): In function `fault()':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_M_destroy(std::allocator<char> const&)'
/tmp/ccbTf8xN.o(.text+0x200): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.text+0x208): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.text+0x215): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.text+0x21d): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.text+0x23a): In function `fault()':
: undefined reference to `std::allocator<char>::allocator(std::allocator<char> const&)'
/tmp/ccbTf8xN.o(.text+0x240): In function `fault()':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_S_empty_rep_storage'
/tmp/ccbTf8xN.o(.text+0x255): In function `fault()':
: undefined reference to `__gnu_cxx::__exchange_and_add(int volatile*, int)'
/tmp/ccbTf8xN.o(.text+0x268): In function `fault()':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_M_destroy(std::allocator<char> const&)'
/tmp/ccbTf8xN.o(.text+0x277): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.text+0x27f): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.text+0x28e): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.text+0x29b): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.text+0x2a3): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.text+0x2ae): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt10_List_baseISsSaISsEE8_M_clearEv+0x3a): In function `std::_List_base<std::basic_string<char, std::char_traits<char>,std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_clear()':
: undefined reference to `std::allocator<char>::allocator(std::allocator<char> const&)'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt10_List_baseISsSaISsEE8_M_clearEv+0x41): In function `std::_List_base<std::basic_string<char, std::char_traits<char>,std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_clear()':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_S_empty_rep_storage'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt10_List_baseISsSaISsEE8_M_clearEv+0x56): In function `std::_List_base<std::basic_string<char, std::char_traits<char>,std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_clear()':
: undefined reference to `__gnu_cxx::__exchange_and_add(int volatile*, int)'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt10_List_baseISsSaISsEE8_M_clearEv+0x6c): In function `std::_List_base<std::basic_string<char, std::char_traits<char>,std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_clear()':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_M_destroy(std::allocator<char> const&)'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt10_List_baseISsSaISsEE8_M_clearEv+0x7b): In function `std::_List_base<std::basic_string<char, std::char_traits<char>,std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_clear()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt10_List_baseISsSaISsEE8_M_clearEv+0x86): In function `std::_List_base<std::basic_string<char, std::char_traits<char>,std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_clear()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt10_List_baseISsSaISsEE8_M_clearEv+0x99): In function `std::_List_base<std::basic_string<char, std::char_traits<char>,std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_clear()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt10_List_baseISsSaISsEE8_M_clearEv+0xa4): In function `std::_List_base<std::basic_string<char, std::char_traits<char>,std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_clear()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt10_List_baseISsSaISsEE11_M_put_nodeEPSt10_List_nodeISsE+0xd): In function `std::_List_base<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_put_node(std::_List_node<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >*)':
: undefined reference to `operator delete(void*)'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE9push_backERKSs+0x14): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::push_back(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
: undefined reference to `operator new(unsigned int)'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE9push_backERKSs+0x32): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::push_back(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
: undefined reference to `__cxa_begin_catch'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE9push_backERKSs+0x3a): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::push_back(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
: undefined reference to `operator delete(void*)'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE9push_backERKSs+0x3f): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::push_back(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
: undefined reference to `__cxa_rethrow'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE9push_backERKSs+0x46): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::push_back(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
: undefined reference to `__cxa_end_catch'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE9push_backERKSs+0x5d): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::push_back(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
: undefined reference to `std::_List_node_base::hook(std::_List_node_base*)'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEEaSERKS1_+0x52): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::operator=(std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZSt10_ConstructISsSsEvPT_RKT0_+0x18): In function `void std::_Construct<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE5eraseESt14_List_iteratorISsE+0x1d): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::erase(std::_List_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >)':
: undefined reference to `std::_List_node_base::unhook()'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE5eraseESt14_List_iteratorISsE+0x38): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::erase(std::_List_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >)':
: undefined reference to `std::allocator<char>::allocator(std::allocator<char> const&)'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE5eraseESt14_List_iteratorISsE+0x3f): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::erase(std::_List_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >)':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_S_empty_rep_storage'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE5eraseESt14_List_iteratorISsE+0x54): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::erase(std::_List_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >)':
: undefined reference to `__gnu_cxx::__exchange_and_add(int volatile*, int)'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE5eraseESt14_List_iteratorISsE+0x6a): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::erase(std::_List_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >)':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_M_destroy(std::allocator<char> const&)'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE5eraseESt14_List_iteratorISsE+0x79): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::erase(std::_List_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >)':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE5eraseESt14_List_iteratorISsE+0x81): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::erase(std::_List_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >)':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE5eraseESt14_List_iteratorISsE+0x94): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::erase(std::_List_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >)':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE5eraseESt14_List_iteratorISsE+0x9c): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::erase(std::_List_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >)':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE5eraseESt14_List_iteratorISsE+0xa4): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::erase(std::_List_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >)':
: undefined reference to `operator delete(void*)'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE6insertISt20_List_const_iteratorISsEEEvSt14_List_iteratorISsET_S7_+0x36): In function `void std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char>> > >::insert<std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >(std::_List_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >)':
: undefined reference to `operator new(unsigned int)'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE6insertISt20_List_const_iteratorISsEEEvSt14_List_iteratorISsET_S7_+0x51): In function `void std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char>> > >::insert<std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >(std::_List_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >)':
: undefined reference to `__cxa_begin_catch'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE6insertISt20_List_const_iteratorISsEEEvSt14_List_iteratorISsET_S7_+0x59): In function `void std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char>> > >::insert<std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >(std::_List_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >)':
: undefined reference to `operator delete(void*)'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE6insertISt20_List_const_iteratorISsEEEvSt14_List_iteratorISsET_S7_+0x5e): In function `void std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char>> > >::insert<std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >(std::_List_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >)':
: undefined reference to `__cxa_rethrow'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE6insertISt20_List_const_iteratorISsEEEvSt14_List_iteratorISsET_S7_+0x65): In function `void std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char>> > >::insert<std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >(std::_List_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >)':
: undefined reference to `__cxa_end_catch'
/tmp/ccbTf8xN.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE6insertISt20_List_const_iteratorISsEEEvSt14_List_iteratorISsET_S7_+0x7c): In function `void std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char>> > >::insert<std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >(std::_List_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >)':
: undefined reference to `std::_List_node_base::hook(std::_List_node_base*)'
/tmp/ccbTf8xN.o(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status




$ gcc -O0 test.cpp
/tmp/ccDliWtk.o(.text+0x57): In function `fault()':
: undefined reference to `std::allocator<char>::allocator()'
/tmp/ccDliWtk.o(.text+0x71): In function `fault()':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
/tmp/ccDliWtk.o(.text+0x97): In function `fault()':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/tmp/ccDliWtk.o(.text+0xa7): In function `fault()':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/tmp/ccDliWtk.o(.text+0xba): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccDliWtk.o(.text+0xcd): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccDliWtk.o(.text+0xd8): In function `fault()':
: undefined reference to `std::allocator<char>::allocator()'
/tmp/ccDliWtk.o(.text+0xf2): In function `fault()':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
/tmp/ccDliWtk.o(.text+0x117): In function `fault()':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/tmp/ccDliWtk.o(.text+0x127): In function `fault()':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/tmp/ccDliWtk.o(.text+0x13a): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccDliWtk.o(.text+0x14a): In function `fault()':
: undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccDliWtk.o(.gnu.linkonce.t._ZNSt4listISsSaISsEEaSERKS1_+0xed): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::operator=(std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/ccDliWtk.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE9_M_insertESt14_List_iteratorISsERKSs+0x29): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_insert(std::_List_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
: undefined reference to `std::_List_node_base::hook(std::_List_node_base*)'
/tmp/ccDliWtk.o(.gnu.linkonce.t._ZSt8_DestroyISsEvPT_+0xd): In function `void std::_Destroy<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >*)':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/tmp/ccDliWtk.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE14_M_create_nodeERKSs+0x36): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_create_node(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
: undefined reference to `__cxa_begin_catch'
/tmp/ccDliWtk.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE14_M_create_nodeERKSs+0x4d): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_create_node(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
: undefined reference to `__cxa_rethrow'
/tmp/ccDliWtk.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE14_M_create_nodeERKSs+0x58): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_create_node(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
: undefined reference to `__cxa_end_catch'
/tmp/ccDliWtk.o(.gnu.linkonce.t._ZN9__gnu_cxx13new_allocatorISt10_List_nodeISsEE10deallocateEPS2_j+0xd): In function `__gnu_cxx::new_allocator<std::_List_node<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::deallocate(std::_List_node<std::basic_string<char, std::char_traits<char>,std::allocator<char> > >*, unsigned int)':
: undefined reference to `operator delete(void*)'
/tmp/ccDliWtk.o(.gnu.linkonce.t._ZSt10_ConstructISsSsEvPT_RKT0_+0x31): In function `void std::_Construct<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/ccDliWtk.o(.gnu.linkonce.t._ZNSt4listISsSaISsEE8_M_eraseESt14_List_iteratorISsE+0xd): In function `std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_erase(std::_List_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >)':
: undefined reference to `std::_List_node_base::unhook()'
/tmp/ccDliWtk.o(.gnu.linkonce.t._ZN9__gnu_cxx13new_allocatorISt10_List_nodeISsEE8allocateEjPKv+0x16): In function `__gnu_cxx::new_allocator<std::_List_node<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::allocate(unsigned int, void const*)':
: undefined reference to `operator new(unsigned int)'
/tmp/ccDliWtk.o(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status




$ emerge info
Portage 2.0.51-r8 (default-linux/x86/2004.3, gcc-3.4.3, glibc-2.3.4.20041102-r0, 2.6.10 i686)
=================================================================
System uname: 2.6.10 i686 mobile AMD  Duron(tm)
Gentoo Base System version 1.6.8
Python:              dev-lang/python-2.2.3-r5,dev-lang/python-2.3.4 [2.3.4 (#1, Nov  8 2004, 23:10:01)]
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.3 [enabled]
dev-lang/python:     2.2.3-r5, 2.3.4
sys-devel/autoconf:  2.59-r6, 2.13
sys-devel/automake:  1.8.5-r2, 1.5, 1.4_p6, 1.6.3, 1.7.9, 1.9.3
sys-devel/binutils:  2.15.92.0.2-r2
sys-devel/libtool:   1.5.10-r2
virtual/os-headers:  2.6.8.1-r1
ACCEPT_KEYWORDS="x86 ~x86"
ASFLAGS=""
AUTOCLEAN="yes"
CBUILD=""
CFLAGS="-march=athlon-xp -O3 -pipe -ffast-math -funroll-loops -fomit-frame-pointer -mfpmath=sse,387 -maccumulate-outgoing-args -fprefetch-loop-arrays -fforce-addr"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /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"
CTARGET=""
CXXFLAGS="-march=athlon-xp -O3 -pipe -ffast-math -funroll-loops -fomit-frame-pointer -mfpmath=sse,387 -maccumulate-outgoing-args -fprefetch-loop-arrays -fforce-addr"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms"
GENTOO_MIRRORS="ftp://sunsite.cnlab-switch.ch/mirror/gentoo/ http://gentoo.oregonstate.edu/"
LDFLAGS=""
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="x86 3dnow X aalib acpi alsa apache2 arts avi berkdb bitmap-fonts bluetooth bzlib cpdflib crypt cscope cups dba dvd encode esd f77 fam flac font-server foomaticdb fortran gd gdbm gif gpm gtk gtk2 imagemagick imlib ipv6 java jpeg junit kde libg++ libwww mad mailwrapper mikmod mmx motif mozilla mpeg mysql ncurses nls nptl nptlonly oggvorbis opengl pam pdflib perl png python qt quicktime readline scanner sdl slang snmp speex spell sse ssl svg svga tcltk tcpd tetex tiff truetype truetype-fonts type1-fonts xml xml2 xmms xprint xsl xv zlib"
Comment 4 Jeremy Huddleston (RETIRED) gentoo-dev 2005-01-23 11:51:52 UTC
I can't reproduce... maybe try trimming some of the CFLAGS used to build gcc and let me know if that works.

(11:50:42 Sun Jan 23 2005 jeremy@cid i686)
~/gentoo/tmp $ g++ -O0 bug77130.c 

(11:50:48 Sun Jan 23 2005 jeremy@cid i686)
~/gentoo/tmp $ g++ -O1 bug77130.c 

(11:50:50 Sun Jan 23 2005 jeremy@cid i686)
~/gentoo/tmp $ g++ -O2 bug77130.c 

(11:50:53 Sun Jan 23 2005 jeremy@cid i686)
~/gentoo/tmp $ g++ -O3 bug77130.c 

(11:50:57 Sun Jan 23 2005 jeremy@cid i686)
~/gentoo/tmp $ g++ -Os bug77130.c 

(11:51:00 Sun Jan 23 2005 jeremy@cid i686)
~/gentoo/tmp $ g++ --version
g++ (GCC) 3.4.3 20050110 (Gentoo Linux 3.4.3.20050110, ssp-3.4.3.20050110-0, pie-8.7.7)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.