[cfe-dev] RFC clang analyzer false positives (for loop)

Jonathan Roelofs via cfe-dev cfe-dev at lists.llvm.org
Fri Aug 26 09:36:38 PDT 2016

On 8/26/16 10:05 AM, Mehdi Amini via cfe-dev wrote:
> Couldn’t there be a “mode” where the analyzer would only report when
> it finds a patch where the condition happens. I.e. instead of
> considering “I don’t know what is the possible value for nr so I
> complain about a possible error”, having the alternate behavior of “I
> know that there is a path where nr can be <= 0 and the loop not
> executed so I complain”.

I think it would be very useful, even if only to explain what 
assumptions the analyzer made when it came to that conclusion. I bet 
that would make it easier to "correct" those assumptions via assertions, 
when you see that it thinks something could happen that you happen to 
know is never true.


> That may suppress a large number of "true positives” indeed, but if
> you start on a “dirty” codebase that may be useful to focus on “real”
> issues.
> — Mehdi
> _______________________________________________ cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded

More information about the cfe-dev mailing list