<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jul 16, 2012, at 3:43 AM, Jonathan Sauer <<a href="mailto:jonathan.sauer@gmx.de">jonathan.sauer@gmx.de</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hello,<br><br>attached is a patch (without tests) to fix <<a href="http://llvm.org/bugs/show_bug.cgi?id=13329">http://llvm.org/bugs/show_bug.cgi?id=13329</a>>.<br>With this patch, the llvm.memcpy instruction generated by clang only copy the whole struct<br>if it is a POD. Otherwise they do no longer copy the tail padding as well, as it can and<br>will be reused for the fields of derived classes.<br><br>If the general approach to fixing this bug is ok I will add the necessary tests.<br></blockquote></div><div><br></div>As noted in the PR:<div><br></div><div><pre class="bz_comment_text" id="comment_text_12" style="font-size: small; white-space: pre-wrap; width: 50em; background-color: rgb(255, 255, 255); ">This is definitely the right approach. A few specific comments:

  - This change should affect the the EmitGCMemmoveCollectable call as well,
since the same bug exists there for Objective-C++ GC
  - There are other CreateMemCpy calls in IR generation that likely need this
same computation. Please factor this computation into a separate routine and
update those callers
  - Please include a test case that generates IR and checks that it does the
right thing</pre><div>Thanks for working on this!</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">    </span>- Doug</div></div></body></html>