On 12/6/20 12:21 PM, Bruno Haible wrote:
Did we discuss the signal
with which the process should be terminated? Division by zero and (INT_MIN / -1)
raise a SIGFPE signal (at least on some CPUs), and this signal is defined as
"Erroneous arithmetic operation." [1] Like you say, signed integer overflow
should raise the same signal. Then, SIGILL is just as wrong as SIGABRT.
I don't remember whether we discussed which signal should be given.
This issue has been a mess for decades; SIGFPE originally was meant just for
floating-point exceptions but got hijacked by some integer operations on many
platforms. At this point it would be better for integer arithmetic overflow to
generate SIGFPE in some way that a signal handler could tell the difference, but
this is not a hill I'm prepared to die on and if it requires significantly more
runtime library code or extra instructions in the executable I wouldn't bother.
It's enough for me that *some* otherwise-unlikely but fatal signal is generated.