diff options
Diffstat (limited to 'lib/Checker/SimpleConstraintManager.cpp')
-rw-r--r-- | lib/Checker/SimpleConstraintManager.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Checker/SimpleConstraintManager.cpp b/lib/Checker/SimpleConstraintManager.cpp index a1594a9e9e..321381b045 100644 --- a/lib/Checker/SimpleConstraintManager.cpp +++ b/lib/Checker/SimpleConstraintManager.cpp @@ -174,9 +174,13 @@ const GRState *SimpleConstraintManager::AssumeAux(const GRState *state, return state; BinaryOperator::Opcode op = SE->getOpcode(); - // FIXME: We should implicitly compare non-comparison expressions to 0. - if (!BinaryOperator::isComparisonOp(op)) - return state; + // Implicitly compare non-comparison expressions to 0. + if (!BinaryOperator::isComparisonOp(op)) { + QualType T = SymMgr.getType(SE); + const llvm::APSInt &zero = BasicVals.getValue(0, T); + op = (Assumption ? BinaryOperator::NE : BinaryOperator::EQ); + return AssumeSymRel(state, SE, op, zero); + } // From here on out, op is the real comparison we'll be testing. if (!Assumption) |