【问题标题】:gcc 3.4 internal compiler error with std::map.find带有 std::map.find 的 gcc 3.4 内部编译器错误
【发布时间】:2012-04-26 04:08:39
【问题描述】:

有没有人在 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 指的是一个布尔运算符

/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

【问题讨论】:

  • gcc 3.4.5 发布于 2005 年(超过 7 年),为什么还没有升级?
  • @JesseGood:也许是因为 OP 不是决定者...

标签: c++ stl gcc3


【解决方案1】:

尝试以下方法之一:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-06-11
    • 1970-01-01
    • 2016-11-13
    • 2014-05-16
    • 1970-01-01
    • 2017-06-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多