Superb discussion of the many types of UB in C/C++ and how to deal with them: https://blog.regehr.org/archives/1520 (infinite loops is my fav oddball UB)