Clang static analysis results for dmd

Robert Clipsham robert at octarineparrot.com
Sun Jul 24 14:43:08 PDT 2011


On 24/07/2011 22:29, Andrei Alexandrescu wrote:
> On 7/24/11 4:06 PM, Robert Clipsham wrote:
>> Hi all,
>>
>> I took the liberty of running dmd through clang's static analysis, and
>> it's turned up quite a few (486) potential bugs in dmd:
>>
>> http://octarineparrot.com/assets/dmd/
>>
>> There's bound to be a few false positives in there (please feel free to
>> report them to the nice folk over at llvm), and the dead code won't
>> cause any problems (and most of the "dead code" in the backend is
>> probably in use with dmc or something), but there are still a few
>> hundred potential crashes in there.
>
> Very interesting. I selected randomly one of each category and found
> only false positives though, mostly because the tool does not understand
> that assert(p) will subsequently guarantee p is non-null, and assert(0)
> terminates the program.
>
> Andrei
>

That's true for quite a few of the null pointer dereferences, there are 
some where there are no assertions though. It might be worth reporting 
these false positives to the folk working on it. In the other categories 
there are far fewer where they're false positives due to the assertion. 
It tends to be the ones with shorter path lengths that exhibit this problem.

-- 
Robert
http://octarineparrot.com/


More information about the Digitalmars-d mailing list