www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Integer ops tests in Clang

reply bearophile <bearophileHUGS lycos.com> writes:
Through Reddit I've just found something nice, "Finding Integer Undefined
Behaviors in C/C++":
http://embed.cs.utah.edu/ubc/

We modified Clang to dynamically detect most of C/C++'s integer undefined
behaviors. Using it, we have found undefined behaviors in nearly every piece of
open source software that we have checked.<
Slowdown due to checking is highly variable, but is in the 0%-30% range for
most codes. A few math-intensive codes (codecs, crypto) slow down by more than
100%. It seems likely that by tuning LLVM and our patch a bit, these overheads
could be substantially reduced.<
In real programs in Delphi I used to see about 10-15% slowdown caused by such runtime tests. This is not that different from the slowdown caused by array bound tests. And you are able to disable them globally or in a part of the code. Bye, bearophile
Apr 08 2011
parent Walter Bright <newshound2 digitalmars.com> writes:
On 4/8/2011 5:39 PM, bearophile wrote:
 Through Reddit I've just found something nice, "Finding Integer Undefined
 Behaviors in C/C++": http://embed.cs.utah.edu/ubc/

 We modified Clang to dynamically detect most of C/C++'s integer undefined
 behaviors. Using it, we have found undefined behaviors in nearly every
 piece of open source software that we have checked.<
Thanks for the link. This is a nice idea.
Apr 08 2011