aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Checker/MemRegion.cpp2
-rw-r--r--test/Analysis/misc-ps-region-store.m19
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;
+}
+