UB can be confusing, but please remember it also means a lot of very reasonable optimization opportunities.<p>Say in data flow analysis, when the compiler can assume &quot;(value + 1) &gt; value&quot; to be always true, a whole expensive branch can be removed.<p>If the overflow is never going to happen anyways, the savings are considerable (expensive branch eliminated) and the result is always correct.