summaryrefslogtreecommitdiffstats
path: root/clang/lib/Checker/RegionStore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Checker/RegionStore.cpp')
-rw-r--r--clang/lib/Checker/RegionStore.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Checker/RegionStore.cpp b/clang/lib/Checker/RegionStore.cpp
index 6b5e5e33f2d..336d3925adc 100644
--- a/clang/lib/Checker/RegionStore.cpp
+++ b/clang/lib/Checker/RegionStore.cpp
@@ -867,6 +867,19 @@ SVal RegionStoreManager::EvalBinOp(BinaryOperator::Opcode Op, Loc L, NonLoc R,
if (!isa<loc::MemRegionVal>(L))
return UnknownVal();
+ // Special case for zero RHS.
+ if (R.isZeroConstant()) {
+ switch (Op) {
+ default:
+ // Handle it normally.
+ break;
+ case BinaryOperator::Add:
+ case BinaryOperator::Sub:
+ // FIXME: does this need to be casted to match resultTy?
+ return L;
+ }
+ }
+
const MemRegion* MR = cast<loc::MemRegionVal>(L).getRegion();
const ElementRegion *ER = 0;
OpenPOWER on IntegriCloud