<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:florian_hahn@apple.com" title="Florian Hahn <florian_hahn@apple.com>"> <span class="fn">Florian Hahn</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - Miscompilation of single loop with two assignments"
   href="https://bugs.llvm.org/show_bug.cgi?id=47793">bug 47793</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>INVALID
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>florian_hahn@apple.com
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - Miscompilation of single loop with two assignments"
   href="https://bugs.llvm.org/show_bug.cgi?id=47793#c3">Comment # 3</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - Miscompilation of single loop with two assignments"
   href="https://bugs.llvm.org/show_bug.cgi?id=47793">bug 47793</a>
              from <span class="vcard"><a class="email" href="mailto:florian_hahn@apple.com" title="Florian Hahn <florian_hahn@apple.com>"> <span class="fn">Florian Hahn</span></a>
</span></b>
        <pre>(In reply to Tuom Larsen from <a href="show_bug.cgi?id=47793#c2">comment #2</a>)
<span class="quote">> Sorry, I'm new to all this. Could you please point me to where you see the
> undefined behaviour? I'm just copying bunch of uint16_t's. Even if I could
> use memcpy, who knows what memcpy would in fact do and this is what broke(?).</span >

The problem is likely that you are accessing the same memory through uint16_t
and uint64_t pointers. Clang assumes 'strict aliasing' by default IIRC and
under those rules I think that is not allowed. See
<a href="http://dbp-consulting.com/tutorials/StrictAliasing.html">http://dbp-consulting.com/tutorials/StrictAliasing.html</a> for an explanation.

Please try your example with -fno-strict-aliasing. Your code should work as
expected with that option. If not, please re-open the issue.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>