|
|
Log in / Subscribe / Register

Signed overflow optimization hazards in the kernel

Signed overflow optimization hazards in the kernel

Posted Aug 17, 2012 16:07 UTC (Fri) by josh (subscriber, #17465)
In reply to: Signed overflow optimization hazards in the kernel by PaulMcKenney
Parent article: Signed overflow optimization hazards in the kernel

What did the arguments against it say, other than "that would remove compiler optimization possibilities"?


to post comments

Signed overflow optimization hazards in the kernel

Posted Aug 18, 2012 18:19 UTC (Sat) by PaulMcKenney (✭ supporter ✭, #9624) [Link]

One objection was that there really are still non-twos-complement machines in common use. As was noted by the comment to this article discussing saturating adders, where 32767+1==32767. But this would be addressed by "implementation defined" rather than "undefined".

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. ;-)


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds