diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-05-27 00:29:00 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-05-27 00:29:00 +0000 |
commit | 32f901092daa4a53c7e012408c1f59d73ba29ff5 (patch) | |
tree | 57144e6273bec080370f3661fffbaf34a93d97dd | |
parent | 261febd091cd05325ae202b7d388a2d266bbf126 (diff) |
Discard qualifiers for ElementRegions so that a 'const' doesn't change the lookup semantics
in the symbol store. We may wish to push this down into the StoreManager itself.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104788 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Checker/MemRegion.cpp | 2 | ||||
-rw-r--r-- | test/Analysis/misc-ps-region-store.m | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/lib/Checker/MemRegion.cpp b/lib/Checker/MemRegion.cpp index 9a664c78a7..575458c9dc 100644 --- a/lib/Checker/MemRegion.cpp +++ b/lib/Checker/MemRegion.cpp @@ -539,7 +539,7 @@ MemRegionManager::getElementRegion(QualType elementType, SVal Idx, const MemRegion* superRegion, ASTContext& Ctx){ - QualType T = Ctx.getCanonicalType(elementType); + QualType T = Ctx.getCanonicalType(elementType).getUnqualifiedType(); llvm::FoldingSetNodeID ID; ElementRegion::ProfileRegion(ID, T, Idx, superRegion); diff --git a/test/Analysis/misc-ps-region-store.m b/test/Analysis/misc-ps-region-store.m index 42551417a2..52516abc39 100644 --- a/test/Analysis/misc-ps-region-store.m +++ b/test/Analysis/misc-ps-region-store.m @@ -1014,3 +1014,22 @@ void pr6854(void * arg) { float f = *(float*) a; } +// <rdar://problem/8032791> False positive due to symbolic store not find +// value because of 'const' qualifier +double rdar_8032791_2(); +double rdar_8032791_1() { + struct R8032791 { double x[2]; double y; } + data[3] = { + {{1.0, 3.0}, 3.0}, // 1 2 3 + {{1.0, 1.0}, 0.0}, // 1 1 2 2 3 3 + {{1.0, 3.0}, 1.0} // 1 2 3 + }; + + double x = 0.0; + for (unsigned i = 0 ; i < 3; i++) { + const struct R8032791 *p = &data[i]; + x += p->y + rdar_8032791_2(); // no-warning + } + return x; +} + |