Integer ops tests in Clang

bearophile bearophileHUGS at lycos.com
Fri Apr 8 17:39:13 PDT 2011


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


More information about the Digitalmars-d mailing list