[cfe-dev] : Analyzer ignoring the effects of a function call?
Don Quixote de la Mancha
quixote at dulcineatech.com
Sun Oct 2 21:00:36 PDT 2011
Put another way: a is unknown only OUTSIDE the basic block of the true
case of the if. Within the basic block, it just has to be zero.
If you don't believe me, try putting "assert( a == 0)" inside the if
statement then run a bunch of tests on your code. The assert will
never trip.
On Sun, Oct 2, 2011 at 8:31 PM, John McCall <rjmccall at apple.com> wrote:
> On Oct 2, 2011, at 5:48 PM, Arjun Singri wrote:
>> But how did it arrive at the conclusion that 'a' was '0' when it is clearly unknown?
>
> It inferred it from the dominating equality test. b is known to be 4, so the only way for a+b to equal 4 is if a is zero.
--
Don Quixote de la Mancha
quixote at dulcineatech.com
Custom Software Development for the iPhone and Mac OS X
http://www.dulcineatech.com/custom-software-development/
More information about the cfe-dev
mailing list