Undefined behaviors & Clang 3.3

Paulo Pinto pjmlp at progtools.org
Thu Jun 20 23:48:27 PDT 2013


On Thursday, 20 June 2013 at 14:28:42 UTC, bearophile wrote:
> Another nice post about the Integer Undefined Behavior 
> Detection of Clang 3.3:
>
> http://blog.regehr.org/archives/963
>
>>Until these languages die, which isn’t going to happen anytime 
>>soon, our best defense against undefined behaviors is to write 
>>better checking tools.<
>
> Some potential bugs it has found:
>
> http://article.gmane.org/gmane.comp.fonts.freetype.devel/8817
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57324
>
> http://blog.regehr.org/extra_files/perl-test-output.txt
>
> Things like this in gcc:
>
> gcc/gcc/simplify-rtx.c:4004:16: runtime error: signed integer 
> overflow: -1844674407370955161 + -9223372036854775808 cannot be 
> represented in type 'long'
> gcc/gcc/stor-layout.c:2543:45: runtime error: signed integer 
> overflow: -9223372036854775808 - 1 cannot be represented in 
> type 'long'
>
> Is someone able to compile and run the dmd source code with 
> Clang with "-fsanitize=undefined"?
> And is it possible to add -fsanitize=undefined to ldc2?
>
> Bye,
> bearophile


I also advise those with Apple accounts to have a look at the 
WWDC 2013 videos, there are a few sessions about LLVM 
optimizations and auto-vectorization in Clang.

Maybe those features could benefit LDC as well.

--
Paulo


More information about the Digitalmars-d mailing list