4 ms·
It exists. Clang has UBSan which can detect many undefined behaviour (https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#available-checks https://clang
by jchb 9y ago
It exists. Clang has UBSan which can detect many undefined behaviour (https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#available-checks https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#...).
It's integrated into Apple's Xcode 9, which can pause into the debugger when encountering an issue.
I was actually using it to debug an issue just as I read your comment.
- iainmerrick 9y agoIt exists, but it doesn't do anything in the example that was discussed recently, "undefined behavior may call a never-called function": https://news.ycombinator.com/item?id=15324414 https://news.ycombinator.com/item?id=15324414 As far as I can tell, -O0 is the only way to avoid that particular mis-optimization in Clang.