<div dir="ltr">Hi edA-qa,<div><br></div><div>EngineBuilder is using unique_ptr, so if it constructed a valid engine it should be passing ownership off just fine.</div><div><br></div><div>That backtrace contains a call to erase on a null SmallPtrSetImpl in the LLVMContext. What LLVMContext are you building the Module with, and are you making sure that the context outlives the module?</div><div><br></div><div>- Lang.<br><div><div><div><br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jun 11, 2016 at 8:59 AM, edA-qa mort-ora-y via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 11/06/16 16:54, Tim Northover wrote:<br>
> The EngineBuilder shouldn't be trying to destroy the module. Looking<br>
> at EngineBuilder::create's control flow, the most plausible problem is<br>
> that the TargetMachine is null, so EngineBuilder::selectTarget has<br>
> gone wrong. If so, maybe the Module's triple is wrong or your LLVM is<br>
> compiled strangely so no targets can be found? Either way, it's<br>
> probably time to pull out the debugger. Tim.<br>
<br>
</span>I'm not sure I've passed an invalid value; I've changed my code to not<br>
delete the engine builder and it works:<br>
<br>
    auto ebuild = new llvm::EngineBuilder(<br>
unique_ptr<llvm::Module>(module) );<br>
    llvm::ExecutionEngine * ee = ebuild-><br>
        setErrorStr( &errStr ).<br>
<span class="">        setEngineKind( llvm::EngineKind::JIT ).<br>
        setTargetOptions( topts ).<br>
        create();<br>
<br>
</span>My code then runs fine. This is pointing towards destruction of the<br>
`EngineBuilder` itself causing the problem (like it's deleting the<br>
module although it shouldn't, since it's been given to the created<br>
`ExecutionEngine`).<br>
<span class="im HOEnZb"><br>
--<br>
edA-qa mort-ora-y<br>
<a href="http://mortoray.com/" rel="noreferrer" target="_blank">http://mortoray.com/</a><br>
<br>
Leaf - the language we always wanted<br>
<a href="http://leaflang.org/" rel="noreferrer" target="_blank">http://leaflang.org/</a><br>
<br>
<br>
</span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</div></div></blockquote></div><br></div>