[cfe-dev] : Analyzer ignoring the effects of a function call?

Joshua Cranmer Pidgeot18 at gmail.com
Sun Oct 2 18:06:29 PDT 2011


On 10/2/2011 7:48 PM, Arjun Singri wrote:
> But how did it arrive at the conclusion that 'a' was '0' when it is 
> clearly unknown? If I don't provide an intial value for 'a', it still 
> reports the same warning. Does that mean that it is interpreting that 
> 'a' is set to zero inside the function?

The value of 'a' is unknown. The value of 'b' is known to be 4. In the 
if statement, for a + b to be equal to 4, a must be 4 - b = 4 - 4 = 0. 
So, within the body of the if statement, 'a' is known to be 0, since any 
other value would fail to satisfy the condition.

-- 
Joshua Cranmer
News submodule owner
DXR coauthor




More information about the cfe-dev mailing list