Hi Anna,

It follows the path for one block. If a check occurs after a dereference in 
that path a warning will be made.

This example don't work since the check occurs in a different block. I would 
like to be able to warn here but i guess we need to follow all blocks and make 
sure a dereference is made on all paths if this example is going to work. How 
do we see that?

//Anders

> 
> Anders,
> 
> Could you describe the high-level algorithm you are using?
> 
> Here is one example I would expect to work.
> int test (int *x, int cond) {
>   if (cond)
>     *x = 1; // expected-warning
>   else
>     *x = 2;  // expected-warning
>   if (!x)
>     return 0;
>  // *x = 0;// no-warning
> 
>   return 1;
> }
> 
> I have a bunch of other minor comments about the other parts of the patch
> that I will send separately.
> 
> Anna.
> 
> > On Sep 25, 2014, at 7:30 AM, Anders Rönnholm
> <[email protected]> wrote:
> >
> > Hi,
> >
> > I have made a new checker similar to the divison by zero i previously
> submitted.
> >
> > This one checks for dereferences that are later compared against zero.
> >
> > As requested i have made it CFG-based like how DeadStores is
> implemented. I hope this is how you meant.
> >
> > //Anders<derefthencheck.diff>


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to