我的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;
该行防止被零除,我的回溯显示如下:
#0 0x00000000004023e8 in CompExp::eval (this=0x7fffec000e40, currVal=0)
at exp.cpp:55
l = -2147483648
r = -1
既然我知道我没有除以零,还有什么可能导致异常?