[PATCH] D12358: [Analyzer] Handling constant bound loops

Ted Kremenek via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 27 23:47:38 PDT 2015


krememek added a comment.

In http://reviews.llvm.org/D12358#234949, @zaks.anna wrote:

> > I accept that my current patch is not a comprehensive solution to the problem and that it may introduce > false positives, however I do think it is an improvement, where it is preferable to have false positives 
>
> >  over doing no analysis after the loop.
>
>
> We try to avoid false positives as much as possible. They are very painful for users to deal with.
>
> > In my experience, constant bound loops are normally used to make simple modifications to fixed 
>
> >  length collections of data, I think the behaviour of the majority of these loops will be represented by 
>
> >  the first and last iteration.
>
>
> The main issue with the patch is that it produces a false path on which value of only one of the variables is reset to the last iteration of the loop and the rest of them are set as if it is the 3d iteration. A way to solve this is to compute what can be invalidated by the loop and set those to unknown values (a widening operation).
>
> You should develop this feature behind a flag. This would allow for incremental development and simplify evaluation.


I agree this should be under a flag, or more specifically, an -analyzer-config option.


http://reviews.llvm.org/D12358





More information about the cfe-commits mailing list