[cfe-commits] r82575 - in /cfe/trunk: lib/Analysis/GRExprEngine.cpp lib/Analysis/RegionStore.cpp test/Analysis/misc-ps-region-store.m test/Analysis/misc-ps.m
Ted Kremenek
kremenek at apple.com
Tue Sep 22 14:19:14 PDT 2009
Author: kremenek
Date: Tue Sep 22 16:19:14 2009
New Revision: 82575
URL: http://llvm.org/viewvc/llvm-project?rev=82575&view=rev
Log:
Fix: <rdar://problem/7242006> [RegionStore] compound literal assignment with floats not honored
Modified:
cfe/trunk/lib/Analysis/GRExprEngine.cpp
cfe/trunk/lib/Analysis/RegionStore.cpp
cfe/trunk/test/Analysis/misc-ps-region-store.m
cfe/trunk/test/Analysis/misc-ps.m
Modified: cfe/trunk/lib/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRExprEngine.cpp?rev=82575&r1=82574&r2=82575&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Tue Sep 22 16:19:14 2009
@@ -2263,6 +2263,7 @@
WorkList.reserve(NumInitElements);
WorkList.push_back(InitListWLItem(Pred, StartVals, E->rbegin()));
InitListExpr::reverse_iterator ItrEnd = E->rend();
+ assert(!(E->rbegin() == E->rend()));
// Process the worklist until it is empty.
while (!WorkList.empty()) {
Modified: cfe/trunk/lib/Analysis/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/RegionStore.cpp?rev=82575&r1=82574&r2=82575&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/RegionStore.cpp (original)
+++ cfe/trunk/lib/Analysis/RegionStore.cpp Tue Sep 22 16:19:14 2009
@@ -1397,6 +1397,7 @@
if (CAT->getElementType()->isStructureType())
state = BindStruct(state, ER, *VI);
else
+ // FIXME: Do we need special handling of nested arrays?
state = Bind(state, ValMgr.makeLoc(ER), *VI);
}
@@ -1448,14 +1449,14 @@
break;
QualType FTy = (*FI)->getType();
- FieldRegion* FR = MRMgr.getFieldRegion(*FI, R);
+ const FieldRegion* FR = MRMgr.getFieldRegion(*FI, R);
- if (Loc::IsLocType(FTy) || FTy->isIntegerType())
- state = Bind(state, ValMgr.makeLoc(FR), *VI);
- else if (FTy->isArrayType())
+ if (FTy->isArrayType())
state = BindArray(state, FR, *VI);
else if (FTy->isStructureType())
state = BindStruct(state, FR, *VI);
+ else
+ state = Bind(state, ValMgr.makeLoc(FR), *VI);
}
// There may be fewer values in the initialize list than the fields of struct.
Modified: cfe/trunk/test/Analysis/misc-ps-region-store.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps-region-store.m?rev=82575&r1=82574&r2=82575&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/misc-ps-region-store.m (original)
+++ cfe/trunk/test/Analysis/misc-ps-region-store.m Tue Sep 22 16:19:14 2009
@@ -181,4 +181,17 @@
return s.x; // no-warning
}
+// <rdar://problem/7242006> [RegionStore] compound literal assignment with
+// floats not honored
+// This test case is mirrored in misc-ps.m, but this case is a negative.
+typedef float CGFloat;
+typedef struct _NSSize {
+ CGFloat width;
+ CGFloat height;
+} NSSize;
+
+CGFloat rdar7242006_negative(CGFloat x) {
+ NSSize y;
+ return y.width; // expected-warning{{garbage}}
+}
Modified: cfe/trunk/test/Analysis/misc-ps.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps.m?rev=82575&r1=82574&r2=82575&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/misc-ps.m (original)
+++ cfe/trunk/test/Analysis/misc-ps.m Tue Sep 22 16:19:14 2009
@@ -643,3 +643,10 @@
// using RegionStore.
}
+// <rdar://problem/7242006> [RegionStore] compound literal assignment with
+// floats not honored
+CGFloat rdar7242006(CGFloat x) {
+ NSSize y = (NSSize){x, 10};
+ return y.width; // no-warning
+}
+
More information about the cfe-commits
mailing list