]> granicus.if.org Git - clang/commitdiff
Fix a bug that leads to infinite loop. Set the correct element type to
authorZhongxing Xu <xuzhongxing@gmail.com>
Mon, 11 May 2009 12:48:56 +0000 (12:48 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Mon, 11 May 2009 12:48:56 +0000 (12:48 +0000)
ElementRegion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71428 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/RegionStore.cpp

index a66e63c8770fdf0a04b8dbf71d22682423ae7cf3..84c8195ecb139171a6fb0d5136790478dfd27dea 100644 (file)
@@ -827,13 +827,11 @@ SVal RegionStoreManager::RetrieveArray(const GRState* St, const TypedRegion* R){
 
   llvm::ImmutableList<SVal> ArrayVal = getBasicVals().getEmptySValList();
   llvm::APSInt Size(CAT->getSize(), false);
-  llvm::APSInt i = getBasicVals().getValue(0, Size.getBitWidth(), 
-                                          Size.isUnsigned());
+  llvm::APSInt i = getBasicVals().getZeroWithPtrWidth(false);
 
   for (; i < Size; ++i) {
     SVal Idx = NonLoc::MakeVal(getBasicVals(), i);
-    ElementRegion* ER = MRMgr.getElementRegion(R->getValueType(getContext()),
-                                               Idx, R);
+    ElementRegion* ER = MRMgr.getElementRegion(CAT->getElementType(), Idx, R);
     QualType ETy = ER->getElementType();
     SVal ElementVal = Retrieve(St, loc::MemRegionVal(ER), ETy);
     ArrayVal = getBasicVals().consVals(ElementVal, ArrayVal);