<div dir="ltr"><div><div><div><br></div><div><p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">----Snip--<br>struct st1{<br>  int a;<br>};<br>struct st2{<br>  int b;<br>};<br>struct st { <br>  struct st1 obj1; <br>  struct st2 obj2;<br>}Obj;<br><br>int test1(struct st1 * ptr1 , struct st2 * ptr2, struct st2 *ptr3) {<br>  ptr1->a = 10; <br>  *ptr3 = *ptr2;<br>  return ptr1->a;<br>}<br>--Snip---<br><br>For the above case GCC is able to store forward the value 10 to the return place.<br>LLVM is not doing this. <br>GCC<br><a href="https://godbolt.org/z/FCjCXy">https://godbolt.org/z/FCjCXy</a>  <br>LLVM <br><a href="https://godbolt.org/z/TFgnig">https://godbolt.org/z/TFgnig</a><br><br>My understanding is that under strict aliasing rules accessing objects of different types don't alias.  <br>In this case we are accessing  "struct st2" object and "int" type object. so aliasing should not prevent the forwarding of store 10 to the return place .<br><br>Can someone please clarify this?</p><p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><br>regards,<br>Venkat.<br></p><p class="MsoNormal" style="margin:0in 0in 0.0001pt"></p></div><div>: </div></div></div></div>