summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/PointerSubChecker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Analysis/PointerSubChecker.cpp')
-rw-r--r--clang/lib/Analysis/PointerSubChecker.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/Analysis/PointerSubChecker.cpp b/clang/lib/Analysis/PointerSubChecker.cpp
index 5cac8aa99e7..20279c67b3e 100644
--- a/clang/lib/Analysis/PointerSubChecker.cpp
+++ b/clang/lib/Analysis/PointerSubChecker.cpp
@@ -48,11 +48,17 @@ void PointerSubChecker::PreVisitBinaryOperator(CheckerContext &C,
const MemRegion *LR = LV.getAsRegion();
const MemRegion *RR = RV.getAsRegion();
- if (!(LR && RR) || (LR == RR))
+ if (!(LR && RR))
return;
- // We don't reason about SymbolicRegions for now.
- if (isa<SymbolicRegion>(LR) || isa<SymbolicRegion>(RR))
+ const MemRegion *BaseLR = LR->getBaseRegion();
+ const MemRegion *BaseRR = RR->getBaseRegion();
+
+ if (BaseLR == BaseRR)
+ return;
+
+ // Allow arithmetic on different symbolic regions.
+ if (isa<SymbolicRegion>(BaseLR) || isa<SymbolicRegion>(BaseRR))
return;
if (ExplodedNode *N = C.GenerateNode(B)) {
OpenPOWER on IntegriCloud