<div dir="ltr">On Wed, Aug 14, 2013 at 4:16 PM, Matt Arsenault <span dir="ltr"><<a href="mailto:Matthew.Arsenault@amd.com" target="_blank">Matthew.Arsenault@amd.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 08/12/2013 04:16 PM, Eli Friedman wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Mon, Aug 5, 2013 at 3:11 PM, Matt Arsenault<br>
<<a href="mailto:Matthew.Arsenault@amd.com" target="_blank">Matthew.Arsenault@amd.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
   Add missing check lines<br>
<br>
   test1_noinbounds shows the current behavior. Why wouldn't it be valid?<br>
</blockquote>
Because you don't know how X was computed, it could be anything.  For<br>
example, it could be "@some_other_zero_int - @G16", an arbitrarily<br>
large number which is not 9, but the address would point at a 0.<br>
<br>
If that's the current behavior, it's a bug.<br>
<br>
-Eli<br>
<br>
</blockquote></div></div>
I still don't really understand. If you're subtracting the addresses of 2 different objects, that's undefined.</blockquote><div><br></div><div>In C, you can write it as "(uintptr_t)&some_other_zero_int - (uintptr_t)&G16".  Subtracting two unsigned ints is never undefined behavior.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If you're accessing somewhere outside of the global, that is also undefined,<br></blockquote><div><br></div>
<div>This is precisely what inbounds indicates; it we don't have inbounds, the arithmetic performed by GEP is defined to be wrapping, so nothing is undefined.</div><div><br></div><div>-Eli</div></div></div></div>