[cfe-commits] r76911 - /cfe/trunk/lib/Analysis/CFG.cpp
sebastian.redl at getdesigned.at
Fri Jul 24 00:48:10 PDT 2009
Ted Kremenek wrote:
> On Jul 23, 2009, at 9:33 PM, Eli Friedman wrote:
>> (int)x == false is semantically equivalent to (int)x == 0 due to
>> integer promotion rules. That said, it is slightly confusing the way
>> it's written.
> The problem isn't with 'x == 0', but with 'x == -1'. Since (I
> believe) both '1' and '-1' convert to true when int is casted to a
> bool, the 'KnownVal == true' would evaluate to true in both cases
> (which isn't the desired behavior).
Integer promotion rules are the same no matter the values. In KnownVal
== true the 'true' literal is converted to the integer 1, and KnownVal
is not touched.
More information about the cfe-commits