Signed overflow optimization hazards in the kernel
Posted Aug 17, 2012 21:57 UTC (Fri) by pdewacht
In reply to: Signed overflow optimization hazards in the kernel
Parent article: Signed overflow optimization hazards in the kernel
But given that Linux is only intended to be compiled by gcc, we can rely on its implementation-defined behavior:
The result of, or the signal raised by, converting an integer to a signed integer type when the value cannot be represented in an object of that type (C90 126.96.36.199, C99 188.8.131.52).
For conversion to a type of width N, the value is reduced modulo 2^N to be within range of the type; no signal is raised.
(and I don't see how any compiler for a two's complement computer could define different behavior.)
to post comments)