by muldvarp · 1y ago · 0 comments
This is only possible if you check for it at runtime and that's a tradeoff most C programmers don't like.
If it's implementation-defined that you can turn them off when you're building for the PDP11, I'm sold.
Exploiting undefined behavior for optimization only requires local analysis, detecting whether that undefined behavior arises (either unconditionally or at all) requires global analysis. To put it differentially: The compiler often simply doesn't know whether the undefined behavior arises, it only knows that the optimization it introduces is valid anyway.