Well, by that reasoning, if you were coding in C, you would certainly think about it and ensure overflows won't happen.
The fact is that if the compiler encounters undefined behaviour, it can do basically whatever it wants and it will still be standard-compliant.