>> +void __ubsan::__ubsan_handle_divrem_overflow
For consistency with asan/tsan you may want to move public functions out of
__ubsan namespace (just have them __ubsan_foo).
The "__" guaranties that no legal program will have the same symbol, while
the simple extern "C" name may slightly simplify debugging (e.g. setting a
break point, etc)

--kcc


On Thu, Oct 4, 2012 at 2:36 PM, Kostya Serebryany <[email protected]> wrote:

>
> 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

Reply via email to