the point of UB is that you can tell your compiler to transform it into a specific behaviour -e.g., an assert with -fsanitize=undefined for instance.
Somehow, undefined behavior in C is a much smaller problem than it looks like. But the principle still applies.