diff options
-rw-r--r-- | Analysis/GRExprEngine.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Analysis/GRExprEngine.cpp b/Analysis/GRExprEngine.cpp index 74fadcc9e3..dedeb7b1b7 100644 --- a/Analysis/GRExprEngine.cpp +++ b/Analysis/GRExprEngine.cpp @@ -846,11 +846,15 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B, NodeTy* N2 = *I2; StateTy St = N2->getState(); - RVal RightV = GetRVal(St, B->getRHS()); + Expr* RHS = B->getRHS(); + RVal RightV = GetRVal(St, RHS); BinaryOperator::Opcode Op = B->getOpcode(); - if (Op == BinaryOperator::Div) { // Check for divide-by-zero. + if ((Op == BinaryOperator::Div || Op == BinaryOperator::Rem) + && RHS->getType()->isIntegerType()) { + + // Check for divide/remaindner-by-zero. // First, "assume" that the denominator is 0. @@ -992,7 +996,10 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B, // Evaluate operands and promote to result type. - if (Op == BinaryOperator::Div) { // Check for divide-by-zero. + if ((Op == BinaryOperator::Div || Op == BinaryOperator::Rem) + && RHS->getType()->isIntegerType()) { + + // Check for divide/remainder-by-zero. // First, "assume" that the denominator is 0. |