<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Nov 26, 2009, at 10:33 AM, Duncan Sands wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><blockquote type="cite"><blockquote type="cite">what if this wraps around the entire address space and lands back on top of<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">the original pointer?<br></blockquote></blockquote><blockquote type="cite">Then that's undefined behavior.<br></blockquote><br>I thought it was only undefined for inbounds GEP?  I'm a bit worried about this<br>because I have a testcase in which the optimizers changed increments by -4 into<br>increments by 2^32 - 4, which would mean that they are creating undefined<br>behaviour where there was none before (PR5282).<br></div></blockquote></div><br><div>This isn't related, it is looking at the access size in this code, not the stride.  The scales are explicitly truncated to pointer size here:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(0, 141, 0); "><span style="color: #000000">      </span>// Make sure that we have a scale that makes sense for this target's</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(0, 141, 0); "><span style="color: #000000">      </span>// pointer size.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">      <span style="color: #d200a5">if</span> (<span style="color: #d200a5">unsigned</span> ShiftBits = <span style="color: #3900de">64</span>-TD->getPointerSizeInBits()) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">        Scale <<= ShiftBits;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">        Scale >>= ShiftBits;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">      }</div><div><font class="Apple-style-span" face="Menlo" size="3"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font></div><div><font class="Apple-style-span" face="Menlo" size="3"><span class="Apple-style-span" style="font-size: 11px;">so it will be handled as -4, not "something crazy".</span></font></div><div><font class="Apple-style-span" face="Menlo" size="3"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font></div><div><font class="Apple-style-span" face="Menlo" size="3"><span class="Apple-style-span" style="font-size: 11px;">-Chris</span></font></div></div></body></html>