Clang static analysis results for dmd

Walter Bright newshound2 at digitalmars.com
Thu Jul 28 14:12:08 PDT 2011


On 7/27/2011 3:50 PM, bearophile wrote:
> I'd like all those tests done by the D compiler too (Clang doesn't perform
> those tests on default because they take time, you have to add the --analyze
> compiler switch). Some of them like Dead store look better as warnings, other
> ones seem better as errors.


The signal to noise ratio of this kind of flow analysis is rather poor. While it 
does find some legitimate bugs, the rate of false positives is far too high to 
be a standard part of the language.

I would agree that adding extra conditionals to the source code will both 
eliminate the false positives and make the code more readable, but those extra 
conditionals exact a performance penalty and would not be something a high 
performance coder would want.

I originally did have stuff like this in the optimizer, but removed it because 
the false positive rate was untenable.


More information about the Digitalmars-d mailing list