I know I might look a bit naïve by saying this, but:
shouldn't we, "C", "C++" programmers, be aware of this ? I mean, delegating some optimizations on our compilers is a good thing, but we definitely *must* be aware of our mistakes [and knowing our mistakes is the most important part]. There's no point of having a very "smart" compiler, when the programmer is slightly "dumb".
I am never sure how my compilers behave, in many situations I do inspect the generated low-level assembly code, and so far I don't recall my compilers to issue bad code, unless I wrote bad code myself. They do not generate optimal code, that is for sure, but if I am explicit about what I want, they always follow my intent.
Undefined behaviour is not a compiler issue, it's a programmer issue. AFAIK some programming languages, like ADA [I have no experience in ADA whatsoever], and VHDL [I have a lot exp. in VHDL] allow you to place explicit compile-time (and run-time) constraints on your data types. Of course, if you don't have these (like in "C", but you surely can have them in "C++") you need to be extra careful.
But again, this boils down to what the programmer writes down. The programmer rules. The programmer writes bugs. The programmer must think three times before writing code (even in ADA and VHDL).
Think before you type. Think again after you type - and remember you're not perfect. Nor your compiler. But you are definitely more important. And definitely smarter.