diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-11-10 02:37:53 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-11-10 02:37:53 +0000 |
commit | adca27102ff733c7d42fcbbc2c7e134a7fc026f9 (patch) | |
tree | 78a3b7bea08e6d6b7ae3d735699ef157381b7094 /lib/Analysis/PointerSubChecker.cpp | |
parent | fbfb52d4cf10b4fd1ac19d1445fe2ffcb9c2bbf1 (diff) |
Refine PointerSubChecker: compare the base region instead of the original
region, so that arithmetic within a memory chunk is allowed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86652 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/PointerSubChecker.cpp')
-rw-r--r-- | lib/Analysis/PointerSubChecker.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/Analysis/PointerSubChecker.cpp b/lib/Analysis/PointerSubChecker.cpp index 5cac8aa99e..20279c67b3 100644 --- a/lib/Analysis/PointerSubChecker.cpp +++ b/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)) { |