A huge number of operations in C++ result in undefined behavior, where the spec is completely mute about what the program\'s behavior ought to be and allows for anything to
The clang compiler can detect some undefined behaviors and warn against them. Probably not as complete as you want, but it's definitely a good start.
clang