核心文件完全是废话,或者这段代码真的抛出了 SIGFPE 吗?
抛出了 SIGFPE。
我的核心文件声称从第 176 行的gcc-4.3.4/include/c++/4.3.4/bits/stl_iterator_base_funcs.h
这在这里:
template<typename _InputIterator, typename _Distance>
inline void
advance(_InputIterator& __i, _Distance __n)
{
// concept requirements -- taken care of in __advance
176----> typename iterator_traits<_InputIterator>::difference_type __d = __n;
std::__advance(__i, __d, std::__iterator_category(__i));
}
这是在我拥有的另一个函数内,该函数确实在调用 advance around通过不执行任何浮点运算的代码。代码是经过优化编译的(但有调试符号),所以事情可能会很混乱。
我的核心文件只是告诉我完全是胡说八道还是有办法让这有意义?
My core file claims that a SIGFPE was thrown from
gcc-4.3.4/include/c++/4.3.4/bits/stl_iterator_base_funcs.h
on line 176. This is here:
template<typename _InputIterator, typename _Distance>
inline void
advance(_InputIterator& __i, _Distance __n)
{
// concept requirements -- taken care of in __advance
176----> typename iterator_traits<_InputIterator>::difference_type __d = __n;
std::__advance(__i, __d, std::__iterator_category(__i));
}
this is inside another function I have that is indeed calling advance surrounding by code that isn't doing any floating point arithmetic. The code is compiled with optimizations (but has debugging symbols), so things may be a big obfuscated.
Is my core file just telling me complete nonsense or is there a way this could make sense?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在回答我自己的问题时,优化器采用了如下所示的代码
并将它们组合起来。这就是为什么信号似乎是从 std::advance 内部发出的。根据 Oli 的评论,当您取相对于 0 的模数时,即使它不是浮点运算,也会发生 SIGFPE。还有一个不同的错误,它允许某些容器在极端情况下为空。
In answer to my own question, what happened is that optimizer took code that looked like this:
and combined them. This is why it appears the signal was raised from inside std::advance. Following Oli's comment, SIGFPE can occur when you take the modulus with respect to 0, even though it isn't a floating point operation. There was a different bug which allowed
somecontainer
to be empty in a corner case.