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.

llvm-svn: 104788
This commit is contained in:
Ted Kremenek 2010-05-27 00:29:00 +00:00
parent c121b4e59f
commit 15a0abd399
2 changed files with 20 additions and 1 deletions

View File

@ -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);

View File

@ -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;
}