GCC 3.4 内部编译器错误与 std::map.find

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

本文关键字:std map find 错误 内部 编译器 GCC      更新时间:2023-10-16

有没有人在 gcc 3.4、boost 1.34.1 中遇到以下错误冲突的代码如下:

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 指的是一个布尔运算符<( const Symbol&) const 成员函数,比较符号类型的两个实例。这在除 gcc 3.4 之外的所有编译器上都运行良好它会导致以下内部编译器错误。

/XYZ/

include/XYZ/AAA/Type/Symbol.h:97:内部编译器错误:在gen_subprogram_die中,在dwarf2out.c:11278

我一直试图找到指向上述在网络上失败的原因的任何指针,但找不到任何解决方案。有没有人遇到过这个变化?或者有人指出为什么 gcc 编译器在这一点上死亡?

感谢您的任何帮助。

/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. 升级您的海湾合作委员会:)
  2. 尝试不同的编译器标志。
  3. 尝试
  4. 复制该头文件并尝试剥离 Symbol 类的声明,直到错误停止,然后从那里拿走它。 看看你是否可以在没有声明的情况下逃脱你正在编译的平台上。
  5. 如果您的目标是获取特定发行版的二进制文件,请尝试在虚拟机中创建该发行版的安装(如果您仍然可以获得它!),升级其 gcc 并使用它进行编译。

我的建议是选项1。 gcc3 的最后一次官方更新我可以在 3.4.6 年 2006 月找到它。 它不会很快得到修复。