<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Nov 13, 2008, at 1:15 AM, Zhongxing Xu wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-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; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; ">Author: zhongxingxu<br>Date: Thu Nov 13 03:15:14 2008<br>New Revision: 59238<br><br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=59238&view=rev">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 class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/RegionStore.cpp?rev=59238&r1=59237&r2=59238&view=diff">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>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><br></div><div>Ted</div><br></body></html>