[cfe-commits] r76911 - /cfe/trunk/lib/Analysis/CFG.cpp
Ted Kremenek
kremenek at apple.com
Thu Jul 23 21:19:56 PDT 2009
On Jul 23, 2009, at 4:25 PM, Mike Stump wrote:
> + // See if this is a known constant.
> + int KnownVal = TryEvaluateBool(B->getLHS());
> + if (KnownVal != -1 && (B->getOpcode() == BinaryOperator::LOr))
> + KnownVal = !KnownVal;
> +
> // Now link the LHSBlock with RHSBlock.
> if (B->getOpcode() == BinaryOperator::LOr) {
> - if (KnownTrue)
> + if (KnownVal == true)
> LHSBlock->addSuccessor(0);
> else
> LHSBlock->addSuccessor(ConfluenceBlock);
> - if (KnownFalse)
> + if (KnownVal == false)
> LHSBlock->addSuccessor(0);
Hi Mike,
This looks a little suspicious to me. Doesn't '-1' convert to 'true'
when an int is casted to a bool? This would cause 'KnowVal == true'
to evaluate to true even when 'KnownVal' is -1.
More information about the cfe-commits
mailing list