4 ms·
Clang has -fcatch-undefined-behavior, "Turn on runtime code generation to check for undefined behavior.". ( http://clang.llvm.org/docs/UsersManual.html http://c
by Argorak 14y ago
Clang has -fcatch-undefined-behavior, "Turn on runtime code generation to check for undefined behavior.". ( http://clang.llvm.org/docs/UsersManual.html http://clang.llvm.org/docs/UsersManual.html )
Afaik, GCC has some flags for specific types of undefined behavior.
- haberman 14y agoThat flag catches four specific instances of undefined behavior, a tiny speck in a sea of all possible ways that undefined behavior can be invoked.
- gregholmberg 14y agoIf you are building your project with Clang, and find that your code causes undefined behavior not caught by any existing in-compiler test, and you can reproduce it, you might want to ... - sign up for the developers' list at http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev , - skim over http://clang.llvm.org/hacking.html http://clang.llvm.org/hacking.html , - build from 'trunk' by carefully following a few simple steps in http://clang.llvm.org/get_started.html http://clang.llvm.org/get_started.html , - wade in and reproduce your bug , ... and then share your findings. Together we can build better tools. Anyone with patience and interest can help.
- haberman 14y agoI think we may have our wires crossed. I'm concerned about undefined behavior in my own programs, not undefined behavior in Clang itself. Someone mentioned Clang as a tool that can help detect UB in other programs, but I mentioned that these checks are far from exhaustive.
- gregholmberg 14y agoSorry, the fault is mine alone. I used an ambiguous description above, now edited. The only point I wanted to make was that a collective effort might help cut down on ambiguity in expression that the compiler does not identify. I think we could use "more warnings".
- Ralith 14y agoHe means to say you're welcome to submit patches to make them more exhaustive.
- deleted 14y ago[deleted]