A bit of background on compilers exploiting signed overflow

Why do compilers even bother with exploiting undefinedness signed overflow? And what are those mysterious cases where it helps?
A lot of people (myself included) are against transforms that aggressively exploit undefined behavior, but I think it's useful to know what compiler writers are accomplishing by this.
TL;DR (Too Long; Didn't Read): C doesn't work very well if int!=register width, but (for backwards compat) int is 32-bit on all major 64-bit targets, and this causes quite hairy problems for code generation and optimization in some fairly common cases. The signed overflow UB (Undefined Behavior) exploitation is an attempt to work around this.

Via Comment on ”Bug in my code from compiler optimization [video] | Hacker News” [1], “A bit of background on compilers exploiting signed overflow [2]”

A cautionary tale about compiler writers exploiting undefined behavior. I don't have much to add here, other than to spread a bit of awareness of why this happens.

=> [1] https://news.ycombinator.com/item?id=38662881 | [2] https://gist.github.com/rygorous/e0f055bfb74e3d5f0af20690759de5a7

=> Gemini Mention this post | Contact the author

Proxy Information
Original URL
gemini://gemini.conman.org/boston/2023/12/19.2
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
558.349977 milliseconds
Gemini-to-HTML Time
0.980345 milliseconds

This content has been proxied by September (3851b).