Signed overflow optimization hazards in the kernel
Signed overflow optimization hazards in the kernel
Posted Aug 16, 2012 21:10 UTC (Thu) by daney (guest, #24551)In reply to: Signed overflow optimization hazards in the kernel by jmspeex
Parent article: Signed overflow optimization hazards in the kernel
> It was definitely undefined in C99 and I'm pretty sure it also was in C89.
The first edition of K & R explicitly states the signed-integer overflow is undefined. This has carried through to the present.
Posted Aug 16, 2012 22:48 UTC (Thu)
by PaulMcKenney (✭ supporter ✭, #9624)
[Link] (2 responses)
Posted Aug 17, 2012 16:07 UTC (Fri)
by josh (subscriber, #17465)
[Link] (1 responses)
Posted Aug 18, 2012 18:19 UTC (Sat)
by PaulMcKenney (✭ supporter ✭, #9624)
[Link]
Another objection was that there are systems still in common use that trap on signed integer overflow. If the C standard required wrapping, compilers for such systems would require special edge-case checks on pretty much any signed integer operation.
And there was of course also the objection that signed integer overflow always has been undefined. ;-)
Signed overflow optimization hazards in the kernel
Signed overflow optimization hazards in the kernel
Signed overflow optimization hazards in the kernel
