News for hackers. Stuff that matters.
Re:ISO C became unusable for operating systems development by tialaramex on Friday January 21, 2022 @09:11PM (#30032506)
As was pointed out to me previously, UBSAN actually provides checking for unsigned overflow even though it's defined. So if signed overflow was defined, that would not stop UBSAN from flagging it.

Because in reality as you observe so many overflows are unintended. Most of the time programmers, especially dealing with 16-bit or wider integer types, treat them as though they were mathematical integers, and so overflow is extraordinary and worth flagging.

Unfortunately UBSAN doesn't prevent you getting this wrong, perhaps somewhere important. If your test inputs never trip the corner case where overflow occurs you can switch off UBSAN in release builds, ship it, and overflow on a real system where it has real consequences.

Re:ISO C became unusable for operating systems development by gpderetta on Saturday January 22, 2022 @06:41AM (#30035837)
Well, TIL, it goes to show how rare are intentional overflows.