asan/tsan/msan generally avoid #including system headers, especially in .h files. Once you start porting the code to non-linux, you'll know why. compiler-rt/lib/sanitizer_common contains lots of useful stuff that allows you to avoid using system headers. WDYT?
--kcc On Thu, Oct 4, 2012 at 12:36 PM, Richard Smith <[email protected]>wrote: > Hi, > > The attached patches to compiler-rt and Clang add a new runtime library > which -fcatch-undefined-behavior will call into when it detects undefined > behavior. Output looks like this (complete with Clang-style highlighting if > it's writing to a terminal): > > $ echo ' > typedef int X; > int main(int argc, char**) { > return *(X*)argc; > }' | ./bin/clang -x c++ - -fcatch-undefined-behavior > $ ./a.out > *<stdin>:4:10: fatal error: load of misaligned address 0x1 for type 'X' > (aka 'int'), which requires 4 byte alignment* > zsh: illegal hardware instruction (core dumped) ./a.out > $ > > I've left -ftrapv's behavior alone, for now at least. > > Review appreciated! > > Thanks, > Richard >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
