gcc 3.4 internal compiler error with std::map.find

428 Views Asked by At

has anybody come across the following error with gcc 3.4, boost 1.34.1 The conflicting code is along the lines of:

class Symbol
{
/// ...
bool operator<( const Symbol& rhs ) const;
};
typedef boost::function< double( const XYZ::Date& ) > F;
typedef std::map<Symbol, F> M;

M aMap; // properly instantiated
Symbol s; // properly instantied

M::const_iterator it = aMap.find( s ); // dies in this call, see below

Symbol.h:97 refers to an bool operator<( const Symbol& ) const member function, that compares two instances of type Symbol. This works fine on all compilers except gcc 3.4 where it cause the following internal compiler error.

/XYZ/include/XYZ/AAA/Type/Symbol.h:97: internal compiler error: in gen_subprogram_die, at dwarf2out.c:11278

I have been trying to find any pointer to the reason the above fails on the web, but could not find any solution. Has anybody come across this by any change ? Or has somebody a pointer to why the gcc compiler dies at that point ?

Thanks for any help.

/XYZ/AAA/Type/Symbol.h: In member function `bool XYZ::Symbol::operator<(const XYZ::Symbol&) const':
/XYZ/AAA/Type/Symbol.h:97:   
instantiated from `bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = XYZ::Symbol]'
/usr/local/include/c++/3.4.5/bits/stl_tree.h:1125:   
instantiated from 

`typename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::find(const _Key&) const 
[with 
_Key = XYZ::Symbol, 
_Val = std::pair<const XYZ::Symbol, boost::function<double ()(const XYZ::Date&), std::allocator<void> > >, 
_KeyOfValue = std::_Select1st<std::pair<const XYZ::Symbol, boost::function<double ()(const XYZ::Date&), std::allocator<void> > > >, 
_Compare = std::less<XYZ::Symbol>, 
_Alloc = std::allocator<std::pair<const XYZ::Symbol, boost::function<double ()(const XYZ::Date&), std::allocator<void> > > >
]'

/usr/local/include/c++/3.4.5/bits/stl_map.h:513:  

instantiated from 

`typename std::_Rb_tree<_Key, std::pair<const I, T>, std::_Select1st<std::pair<const I, T> >, _Compare, _Alloc>::const_iterator std::map<_Key, _Tp, _Compare, _Alloc>::find(const _Key&) const 

[with 
_Key = XYZ::Symbol, 
_Tp = boost::function<double ()(const XYZ::Date&), std::allocator<void> >, 
_Compare = std::less<XYZ::Symbol>, 
_Alloc = std::allocator<std::pair<const XYZ::Symbol, boost::function<double ()(const XYZ::Date&), std::allocator<void> > > >
]'

AFunc.cpp:70:   instantiated from here
/XYZ/include/XYZ/AAA/Type/Symbol.h:97: internal compiler error: in gen_subprogram_die, at dwarf2out.c:11278
1

There are 1 best solutions below

0
On

Try one of these:

  1. upgrade your gcc :)
  2. try different compiler flags.
  3. try making a copy of that header file and attempting to strip down the declaration of the Symbol class until the error stops, then take it from there. See if you can get away without a declaration on the platform your are compiling on.
  4. If your goal is to get binaries for a particular distro, try creating an install of that distro in a virtual machine (if you can still get it!), upgrading its gcc and compiling with that.

My recommenation is option 1. The last official update to gcc3 I could find it 3.4.6 in March 2006. It is not going to get fixed any time soon.