Do not model loads from complex types, since we don't accurately model the imaginary and real parts yet.

Fixes false positive reported in <rdar://problem/12964481>.

llvm-svn: 171987
This commit is contained in:
Ted Kremenek 2013-01-09 18:46:17 +00:00
parent 6922e9ca7e
commit 2f2edd3fb1
2 changed files with 21 additions and 0 deletions

View File

@ -1133,6 +1133,11 @@ SVal RegionStoreManager::getBinding(RegionBindingsConstRef B, Loc L, QualType T)
const TypedValueRegion *R = cast<TypedValueRegion>(MR);
QualType RTy = R->getValueType();
// FIXME: we do not yet model the parts of a complex type, so treat the
// whole thing as "unknown".
if (RTy->isAnyComplexType())
return UnknownVal();
// FIXME: We should eventually handle funny addressing. e.g.:
//
// int x = ...;

View File

@ -705,3 +705,19 @@ void rdar12759044() {
*p = 0xDEADBEEF; // no-warning
}
}
// The analyzer currently does not model complex types. Test that the load
// from 'x' is not flagged as being uninitialized.
typedef __complex__ float _ComplexT;
void rdar12964481(_ComplexT *y) {
_ComplexT x;
__real__ x = 1.0;
__imag__ x = 1.0;
*y *= x; // no-warning
}
void rdar12964481_b(_ComplexT *y) {
_ComplexT x;
// Eventually this should be a warning.
*y *= x; // no-warning
}