On 21 May 2018 at 20:08, Mateusz Loskot <mate...@loskot.net> wrote:
> On 21 May 2018 at 19:27, Jan Korous <jkor...@apple.com> wrote:
>>
>> You are hitting UB because of signed integer overflow.
>> [...]
>>
>> BTW This is a perfect opportunity to try out UndefinedBehaviorSanitizer!
>>
>> https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
>>
>>> clang++ -fsanitize=signed-integer-overflow overflow.cpp
>>> ./a.out
>> -2147483648
>> overflow.cpp:24:52: runtime error: signed integer overflow: 2147483647 - 
>> -2147483648 cannot be represented in type 'int'
>
> Hi Jan,
>
> This is very helpful indeed.

Jan, thank you very much!

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net
_______________________________________________
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

Reply via email to