Clang static analysis results for dmd
Brad Roberts
braddr at slice-2.puremagic.com
Fri Jul 29 14:53:29 PDT 2011
On Fri, 29 Jul 2011, Walter Bright wrote:
> On 7/29/2011 1:35 PM, Trass3r wrote:
> > > Here's another one:
> > >
> > > T* p;
> > > ...
> > > if (A)
> > > p = &t;
> > > ...
> > > if (B)
> > > ... *p ...
> > >
> > > B is true if and only if A is true. B can even be the same expression as
> > > A,
> > > such as a->b->c. Clang complains on the *p that p is "uninitialized".
> > ...
> > > At what point does this cease to be fixing "bugs" and become "contort to
> > > fit
> > > clang's quirks"?
> >
> > Clang's static analysis isn't very mature yet.
>
> It's not about maturity, it's simply impossible to correctly do the above
> case.
You keep using the term impossible. It's impossible to be 100% correct in
100% of the code bases. Sure, but that's obviously not the goal. The
goal is to be correct enough on enough code to be useful. A far more
achievable goal. Clang isn't there yet, but with time and effort it can
improve towards that goal. That's where producing test cases on things it
fails on is useful.. standard bug reporting (or feature gap reporting in
this case).
If B can be shown to be a super set of A, which is very doable for a
reasonable set of cases, then that false positive can be eliminated.
Continuing to think of these tools as either perfect or useless and useful
discussions about them are kinda hard to have.
Later,
Brad
More information about the Digitalmars-d
mailing list