Re:My favourite C++ footgun
by vnorilo on Wednesday June 23, 2021 @04:43AM
(#27602261)
Most optimization uses of UB that I've seen is to take full liberty to remove branches and instructions. For example, if the result of UB is used in a comparison, the compiler is free to pick whichever side of the branch (even inconsistently) and elide. It is actually quite common with for example loop unrolling and vectorization (ignoring signed overflow of the indvar is a huge boon)
[ Parent
| on HN ]