cro*_*ale 5 c++ gdb exception arithmeticexception
我的Floating point exception (core dumped)C++程序中出现错误,gdb显示问题出在执行模数除法的行上:
Program received signal SIGFPE, Arithmetic exception.
[Switching to Thread 0x7ffff6804700 (LWP 13931)]
0x00000000004023e8 in CompExp::eval (this=0x7fffec000e40, currVal=0)
at exp.cpp:55
55 return (r==0) ? 0 : l % r;
Run Code Online (Sandbox Code Playgroud)
该线防止零除,我的回溯显示以下内容:
#0 0x00000000004023e8 in CompExp::eval (this=0x7fffec000e40, currVal=0)
at exp.cpp:55
l = -2147483648
r = -1
Run Code Online (Sandbox Code Playgroud)
既然我知道我没有除以零,那还有什么可能导致异常呢?