Conversation

This Tweet was deleted by the Tweet author. Learn more
It's always implemented in software via hardware features. The features vary in performance. Jump-on-overflow is a lot worse than architectures with support for enabling a trapping mode, whether it's strict or propagates a poison value that can never be accessed (since it traps).
1
1
Hardware doesn't implement C, so there isn't a standard behavior defined by hardware. It's up to the compiler to map C onto the hardware or the virtual machine. They get to choose how to handle each kind of undefined or implementation defined behavior, and everything else.
2
1
No, that's not what I've been saying. I think it would be a serious regression to break compatibility with safe implementations by making it correct to be incompatible with them. You want to massively roll back safety and security, especially if you want to remove it by default.
2
1
Yeah, it's a lot easier to introduce signed overflow checking, since portable C is already compatible with it and there are also simply a lot more use cases for intended signed overflow. Much harder to mark every intended unsigned overflow and fix all benign unintended cases.
1
1
And by benign cases, I mean that it's extremely common to have issues like overflowing by one after it no longer matters because the value isn't being read anymore. AOSP adopted automatic integer overflow for hardening and it wasn't easy to get it working. Lots of changes needed.
1
1
There aren't really that many intended cases: hash functions, counters that are meant to wrap, cryptography, etc. and it's really not that bad to mark functions or files with no_sanitize(unsigned_integer_overflow). More specific cases can use a wrapper around the intrinsics.