<div dir="ltr">The comment is an excellent idea: I've added one in r312205.<div><br></div><div>I'll have to think about the test case: This was a use-after free bug so I think it would only reliably show up under msan.</div><div><br></div><div>Side note: I'm finally finding some more time to spend on the JIT APIs. Yay! I hope this will continue -- I'd like to return to API modernization, and hope to chat about the path forward at the Dev Meeting. :)</div><div><br></div><div>Cheers,</div><div>Lang.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 29, 2017 at 7:13 PM, Philip Reames <span dir="ltr"><<a href="mailto:listmail@philipreames.com" target="_blank">listmail@philipreames.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Clear comment?  Test case?<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
On 08/29/2017 05:47 PM, Lang Hames via llvm-commits wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: lhames<br>
Date: Tue Aug 29 17:47:42 2017<br>
New Revision: 312086<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=312086&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=312086&view=rev</a><br>
Log:<br>
[Orc] Fix member variable ordering issue in OrcMCJITReplacement.<br>
<br>
<a href="https://reviews.llvm.org/D36888" rel="noreferrer" target="_blank">https://reviews.llvm.org/D3688<wbr>8</a><br>
<br>
 From that review description:<br>
<br>
When an OrcMCJITReplacement object gets destructed, LazyEmitLayer may still<br>
contain a shared_ptr of a module, which requires ShouldDelete in the deleter.<br>
But ShouldDelete gets destructed before LazyEmitLayer due to the order of<br>
declaration in OrcMCJITReplacement, which leads to a crash, when the destructor<br>
of LazyEmitLayer is executed.  Changing the order of declaration fixes this.<br>
<br>
Patch by Moritz Kroll. Thanks Moritz!<br>
<br>
<br>
Modified:<br>
     llvm/trunk/lib/ExecutionEngin<wbr>e/Orc/OrcMCJITReplacement.h<br>
<br>
Modified: llvm/trunk/lib/ExecutionEngine<wbr>/Orc/OrcMCJITReplacement.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h?rev=312086&r1=312085&r2=312086&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/llvm/trunk/lib/Execution<wbr>Engine/Orc/OrcMCJITReplacement<wbr>.h?rev=312086&r1=312085&r2=<wbr>312086&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/ExecutionEngine<wbr>/Orc/OrcMCJITReplacement.h (original)<br>
+++ llvm/trunk/lib/ExecutionEngine<wbr>/Orc/OrcMCJITReplacement.h Tue Aug 29 17:47:42 2017<br>
@@ -381,6 +381,9 @@ private:<br>
    std::shared_ptr<JITSymbolResol<wbr>ver> ClientResolver;<br>
    Mangler Mang;<br>
  +  std::map<Module*, bool> ShouldDelete;<br>
+  std::vector<std::shared_ptr<Mo<wbr>dule>> LocalModules;<br>
+<br>
    NotifyObjectLoadedT NotifyObjectLoaded;<br>
    NotifyFinalizedT NotifyFinalized;<br>
  @@ -402,8 +405,6 @@ private:<br>
    std::map<ObjectLayerT::ObjHand<wbr>leT, SectionAddrSet, ObjHandleCompare><br>
        UnfinalizedSections;<br>
  -  std::map<Module*, bool> ShouldDelete;<br>
-  std::vector<std::shared_ptr<Mo<wbr>dule>> LocalModules;<br>
    std::vector<object::OwningBina<wbr>ry<object::Archive>> Archives;<br>
  };<br>
  <br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote>
<br>
</div></div></blockquote></div><br></div>