[cfe-commits] r65035 - /cfe/trunk/lib/Analysis/RegionStore.cpp
Zhongxing Xu
xuzhongxing at gmail.com
Thu Feb 19 00:37:17 PST 2009
Author: zhongxingxu
Date: Thu Feb 19 02:37:16 2009
New Revision: 65035
URL: http://llvm.org/viewvc/llvm-project?rev=65035&view=rev
Log:
Convert the offset to signed before making an ElementRegion with it. It seems
that this problem arises from time to time. We should find a fundamental
solution for it.
Modified:
cfe/trunk/lib/Analysis/RegionStore.cpp
Modified: cfe/trunk/lib/Analysis/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/RegionStore.cpp?rev=65035&r1=65034&r2=65035&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/RegionStore.cpp (original)
+++ cfe/trunk/lib/Analysis/RegionStore.cpp Thu Feb 19 02:37:16 2009
@@ -367,6 +367,16 @@
//
// Observe that 'p' binds to an AnonTypedRegion<AllocaRegion>.
//
+
+ // Offset might be unsigned. We have to convert it to signed ConcreteInt.
+ if (nonloc::ConcreteInt* CI = dyn_cast<nonloc::ConcreteInt>(&Offset)) {
+ const llvm::APSInt& OffI = CI->getValue();
+ if (OffI.isUnsigned()) {
+ llvm::APSInt Tmp = OffI;
+ Tmp.setIsSigned(true);
+ Offset = NonLoc::MakeVal(getBasicVals(), Tmp);
+ }
+ }
return loc::MemRegionVal(MRMgr.getElementRegion(Offset, BaseRegion));
}
@@ -397,7 +407,7 @@
Tmp.setIsSigned(true);
Tmp += BaseIdxI; // Compute the new offset.
- NewIdx = nonloc::ConcreteInt(getBasicVals().getValue(Tmp));
+ NewIdx = NonLoc::MakeVal(getBasicVals(), Tmp);
}
else
NewIdx = nonloc::ConcreteInt(getBasicVals().getValue(BaseIdxI + OffI));
More information about the cfe-commits
mailing list