On 09/22/2015 06:26 AM, Marek Polacek wrote:
On Mon, Sep 21, 2015 at 07:06:01PM +0200, Marek Polacek wrote:
I realized that current patch has a minor deficiency: it will start
a chain even in case the first condition has a side-effect thus the
chain should be invalid.  I'll fix this problem soon.

I changed my mind, the above mean we'll warn for

int
fn3 (void)
{
   if (bar ())
     return 1;
   else if (a)
     return 2;
   else if (a);
     return 3;
   return 0;
}

But I think that's ok to warn on.

I agree.


So the v2 patch I posted is still the latest one.

It's fine by me (for whatever it's worth).

Btw., if you're unhappy about having to wipe out the whole chain
after every side-effect it occurred to me that it might be possible
to do better: instead of deleting the whole chain, only remove from
it the elements that may be affected by the side-effect. This should
make it possible to keep on the chain all conditions involving local
variables whose address hasn't been taken, which I would expect to
be most in most cases.

Martin

Reply via email to