To be consistent, make the index of the ElementRegion always signed.

llvm-svn: 60248
This commit is contained in:
Zhongxing Xu 2008-11-29 12:05:04 +00:00
parent 5661fead0b
commit 452273d9c6
2 changed files with 6 additions and 2 deletions

View File

@ -415,7 +415,11 @@ class ElementRegion : public TypedRegion {
SVal Index;
ElementRegion(SVal Idx, const MemRegion* sReg)
: TypedRegion(sReg, ElementRegionKind), Index(Idx) {}
: TypedRegion(sReg, ElementRegionKind), Index(Idx) {
// The index must be signed.
if (nonloc::ConcreteInt* CI = dyn_cast<nonloc::ConcreteInt>(&Idx))
assert(CI->getValue().isSigned());
}
static void ProfileRegion(llvm::FoldingSetNodeID& ID, SVal Idx,
const MemRegion* superRegion);

View File

@ -646,7 +646,7 @@ Store RegionStoreManager::InitializeArray(Store store, const TypedRegion* R,
nonloc::CompoundVal::iterator VI = CV.begin(), VE = CV.end();
for (; i != Size; ++i) {
nonloc::ConcreteInt Idx(getBasicVals().getValue(llvm::APSInt(i)));
nonloc::ConcreteInt Idx(getBasicVals().getValue(llvm::APSInt(i, false)));
ElementRegion* ER = MRMgr.getElementRegion(Idx, R);