[PATCH] Dereference then check

Anna Zaks ganna at apple.com
Tue Sep 30 18:21:20 PDT 2014


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 <Anders.Ronnholm at evidente.se> 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>





More information about the cfe-commits mailing list