<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Jul 16, 2012, at 10:24 PM, Douglas Gregor wrote:</div><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=us-ascii"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><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><blockquote type="cite">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></div></blockquote><br></div><div>I actually fixed this in 153613, as a fix for PR12204.  I was then asked</div><div>to revert my change because it caused significant compile-time</div><div>regressions under a bootstrap build.  My previous commit is still</div><div>correct, but I haven't had time to revisit it and perform the necessary</div><div>performance testing;  if Jonathan would like to do so, that would be</div><div>great.</div><div><br></div><div>John.</div><br></body></html>