> On 7 Oct 2019, at 07:15, Akim Demaille <[email protected]> wrote: > >> Le 2 oct. 2019 à 15:58, Paul Eggert <[email protected]> a écrit : >> >> On 10/1/19 10:27 PM, Akim Demaille wrote: >>> I don't understand why you shy away from -128 and -32768 though. >> >> The C Standard doesn't guarantee support for -128 and -32768. This >> originally was for ones' complement machines such as the Unisys ClearPath >> Dorado enterprise servers (still in use via firmware translation to Intel >> Xeon, and they have a C compiler), > > Wow! I was unaware of this. Ain't it this kind of machines that is still in > use to run ancient COBOL programs? Are they still used in production for > programs written in C?
The C/C++ compiler is still allowed to use it for optimizations, even though all current hardware I think use modulo 2^k representations; there is an example here: http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html#signed_overflow Then this links gives an example how the optimizer can remove an overflow check, causing a security issue: http://blog.llvm.org/2011/05/what-every-c-programmer-should-know_14.html
