Previous: Signed Overflow Advice, Up: Integer Overflow [Contents][Index]
Overflow in signed
integer division is not always harmless: for example, on CPUs of the
i386 family, dividing INT_MIN
by -1
yields a SIGFPE signal
which by default terminates the program. Worse, taking the remainder
of these two values typically yields the same signal on these CPUs,
even though the C standard requires INT_MIN % -1
to yield zero
because the expression does not overflow.