]> granicus.if.org Git - clang/commitdiff
Make RegionStoreManager::InitializeArray safe against array sizes that don't have...
authorSebastian Redl <sebastian.redl@getdesigned.at>
Tue, 2 Dec 2008 16:47:35 +0000 (16:47 +0000)
committerSebastian Redl <sebastian.redl@getdesigned.at>
Tue, 2 Dec 2008 16:47:35 +0000 (16:47 +0000)
This may be the case on 64-bit systems. Whether that fact is a bug is a different question, but it's easy to cure the symptom.

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

lib/Analysis/RegionStore.cpp

index 92f4a6e71410174b4f6f2e6c769e9e7d6ae1cf9d..9753b914f2c7fbae319bb2cb9d55820f553d57d8 100644 (file)
@@ -639,7 +639,8 @@ Store RegionStoreManager::InitializeArray(Store store, const TypedRegion* R,
 
   llvm::APSInt Size(CAT->getSize(), false);
 
-  llvm::APSInt i = getBasicVals().getZeroWithPtrWidth(false);
+  llvm::APSInt i = getBasicVals().getValue(0, Size.getBitWidth(),
+                                           Size.isUnsigned());
 
   // Check if the init expr is a StringLiteral.
   if (isa<loc::MemRegionVal>(Init)) {