It violates the principle of least surprise. You don't expect the compiler to delete your bounds checking etc.
The way c and c++ define and use UB is like finding an error at compile time and instead of reporting it, the compiler decides to exploit it.
And I recommend you read Chris Latter's essay on UB.
https://blog.llvm.org/2011/05/what-every-c-programmer-should-know_14.html
Where he gives plenty of examples of UB resulting in the compiler optimizing away safety and introducing security vulnerabilities silently. In part 3 he discusses the efforts clang has made to improve on this.
He then went on to make Swift and says this: "Undefined behavior is the enemy of safety, and developer mistakes should be caught before software is in production."
and
"UB is an inseperable part of C programming, […] this is a depressing and faintly terrifying thing. The tooling built around the C family of languages helps make the situation less bad, but it is still pretty bad. The only solution is to move to new programming languages that dont inherit the problem of C."