<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><font face="arial, helvetica, sans-serif">You don't have x1 and x2 in your example, assuming you mean:<br>
<br>
int i = 0;<br>
T A;<br>
T * y2 = ...<br>
{<br>
T * x1 = &A;<br>
a = x1[i];<br>
}<br>
{<br>
T * restrict x2 = y2;<br>
b = x2[i];<br>
}<br>
<br>
then the answer is no, the fact that x2 is restrict qualified does not allow us to conclude that &x2[i] and &x1[i] don't alias.<span class=""><br></span></font></blockquote><div><font face="arial, helvetica, sans-serif"><br></font></div><div><div class="gmail_default"><font face="arial, helvetica, sans-serif">It should, no? by virtue of x2 being restrict you know that *x2 doesn't alias A, and *x1 is A.</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">This example is flawed anyway because it only has loads, so the aliasing isn't that interesting. Something more realistic:</font></div></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><div class="gmail_default"><font face="arial, helvetica, sans-serif"> T <div class="gmail_default" style="display:inline">A, B</div><br></font></div></div><div class="gmail_default"><div><font face="arial, helvetica, sans-serif"> T * x1 = <div class="gmail_default" style="display:inline">.... // either &A or &B</div></font></div></div></div><div class="gmail_quote"><div><font face="arial, helvetica, sans-serif"> T * y2 = <div class="gmail_default" style="display:inline">.... // </div><div class="gmail_default" style="display:inline">maybe &A</div></font></div><div><span style="font-family:arial,helvetica,sans-serif"><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline"> </div>{</span><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"> T * restrict x2 = y2;</font></div><font face="arial, helvetica, sans-serif"> <div class="gmail_default" style="font-family:verdana,sans-serif;display:inline">*</div>x<div class="gmail_default" style="display:inline">1</div><div class="gmail_default" style="display:inline"> = ...</div><br></font><div><font face="arial, helvetica, sans-serif"> <div class="gmail_default" style="font-family:verdana,sans-serif;display:inline">*</div>x2<div class="gmail_default" style="display:inline"> = ...</div><br> }<br></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><div class="gmail_default"><font face="arial, helvetica, sans-serif">In this case you'll be able to tell *x1 doesn't alias *x2, right? How about if you add restrict to x1?</font></div><br></div></div></div></div>