RegionStore::getLValueElement: Handle the case where the signedness of the
offset may be different that the base. Ultimately we need a better solution for
these issues, but this point-by-point fixes are gradually outlining the scope of
the problem.

llvm-svn: 66638
diff --git a/clang/lib/Analysis/RegionStore.cpp b/clang/lib/Analysis/RegionStore.cpp
index 2f4d70a..6253e61 100644
--- a/clang/lib/Analysis/RegionStore.cpp
+++ b/clang/lib/Analysis/RegionStore.cpp
@@ -630,8 +630,12 @@
 
   // Only support concrete integer indexes for now.
   if (Base && Offset) {
-    SVal NewIdx = Base->EvalBinOp(getBasicVals(), Op, *Offset);
-
+    // For now, convert the signedness of offset in case it doesn't match.
+    const llvm::APSInt &I =
+      getBasicVals().ConvertSignedness(Base->getValue(), Offset->getValue());    
+    nonloc::ConcreteInt OffsetConverted(I);
+    
+    SVal NewIdx = Base->EvalBinOp(getBasicVals(), Op, OffsetConverted);
     const MemRegion* NewER = MRMgr.getElementRegion(NewIdx, 
                                                     ER->getArrayRegion());
     return Loc::MakeVal(NewER);