clang has UBSan, which adds runtime checks for detecting various kinds of undefined behaviour: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
Or the famous optimized away memset call. Which is a security issue. At least a warning would be in order. Or at least an analyzer warning.