<br><br><div class="gmail_quote">On Thu, Nov 13, 2008 at 11:03 PM, Ted Kremenek <span dir="ltr"><<a href="mailto:kremenek@apple.com">kremenek@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style=""><div><div></div><div class="Wj3C7c"><br><div><div>On Nov 13, 2008, at 1:15 AM, Zhongxing Xu wrote:</div><br><blockquote type="cite"><span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">Author: zhongxingxu<br>
Date: Thu Nov 13 03:15:14 2008<br>New Revision: 59238<br><br>URL:<span> </span><a href="http://llvm.org/viewvc/llvm-project?rev=59238&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=59238&view=rev</a><br>
Log:<br>Array index might be unsigned. We have to generate a temporary signed value for<br>it to be evaluated by APSInt::operators.<br><br>Modified:<br>   cfe/trunk/lib/Analysis/RegionStore.cpp<br><br>Modified: cfe/trunk/lib/Analysis/RegionStore.cpp<br>
URL:<span> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/RegionStore.cpp?rev=59238&r1=59237&r2=59238&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/RegionStore.cpp?rev=59238&r1=59237&r2=59238&view=diff</a><br>
<br>==============================================================================<br>--- cfe/trunk/lib/Analysis/RegionStore.cpp (original)<br>+++ cfe/trunk/lib/Analysis/RegionStore.cpp Thu Nov 13 03:15:14 2008<br>@@ -197,6 +197,18 @@<br>
  // Only handle integer indices for now.<br>  if ((CI1 = dyn_cast<nonloc::ConcreteInt>(&Idx)) &&<br>      (CI2 = dyn_cast<nonloc::ConcreteInt>(&Offset))) {<br>+<br>+    // Temporary SVal to hold a potential signed APSInt.<br>
+    SVal SignedInt;<br>+<br>+    // Index might be unsigned. We have to convert it to signed.<br>+    if (CI2->getValue().isUnsigned()) {<br>+      llvm::APSInt SI = CI2->getValue();<br>+      SI.setIsSigned(true);<br>
+      SignedInt = nonloc::ConcreteInt(getBasicVals().getValue(SI));<br>+      CI2 = cast<nonloc::ConcreteInt>(&SignedInt);<br>+    }<br>+</span></blockquote><br></div></div></div><div>Hi Zhongxing,</div><div><br>
</div><div>I'm not saying this isn't needed, but is there a particular justification for the signed -> unsigned conversion?  (I actually don't know by just looking at your patch).  It seems like things like this should go in GRExprEngine, not the Store.</div>
<div></div></div></blockquote><div><br>Consistent signedness is required by llvm::APSInt. So we should find a place to handle this. May be we should ensure all ConcreteInt be signed in GRExprEngine? <br></div></div><br>