[llvm-dev] SegFault creating a ExecutionEngine

edA-qa mort-ora-y via llvm-dev llvm-dev at lists.llvm.org
Sat Jun 11 02:29:47 PDT 2016


My code to create an ExecutionEngine is segfaulting:

    std::string errStr;
    llvm::ExecutionEngine * ee = llvm::EngineBuilder(
unique_ptr<llvm::Module>(module) )
        .setErrorStr( &errStr ) //line 1618
        .setEngineKind( llvm::EngineKind::JIT )

Where module is a `llvm::Module*`. This is code I'm migrating from 3.3
to 3.8. Since the deletion error is happening during constructor I'm at
a bit of a loss as to what I'm doing wrong.

The stack trace from gdb is:

#0  0x00007ffff1195a02 in llvm::SmallPtrSetImplBase::isSmall (this=0x0)
at /opt/llvm/include/llvm/ADT/SmallPtrSet.h:128
#1  0x00007ffff11e37d3 in llvm::SmallPtrSetImplBase::erase_imp
(this=0x0, Ptr=0x68c200) at /opt/llvm/lib/Support/SmallPtrSet.cpp:78
#2  0x00007ffff14c9174 in llvm::SmallPtrSetImpl<llvm::Module*>::erase
(this=0x0, Ptr=0x68c200) at /opt/llvm/include/llvm/ADT/SmallPtrSet.h:275
#3  0x00007ffff14c81cb in llvm::LLVMContext::removeModule
(this=0x691910, M=0x68c200) at /opt/llvm/lib/IR/LLVMContext.cpp:148
#4  0x00007ffff1527b7b in llvm::Module::~Module (this=0x68c200,
__in_chrg=<optimised out>) at /opt/llvm/lib/IR/Module.cpp:57
#5  0x00007ffff70f9511 in std::default_delete<llvm::Module>::operator()
(this=<optimised out>, __ptr=0x68c200) at
/usr/include/c++/5/bits/unique_ptr.h:76
#6  std::unique_ptr<llvm::Module, std::default_delete<llvm::Module>
>::~unique_ptr (this=<optimised out>, __in_chrg=<optimised out>) at
/usr/include/c++/5/bits/unique_ptr.h:236
#7  0x00007ffff26318ba in llvm::EngineBuilder::~EngineBuilder
(this=0x7fffffffced0, __in_chrg=<optimised out>) at
/opt/llvm/include/llvm/ExecutionEngine/ExecutionEngine.h:512
#8  0x00007ffff70f75a1 in ir_llvm::gen::create_engine
(this=this at entry=0x7fffffffd1d0) at src/ir/llvm/gen.cpp:1618
#9  0x00007ffff70f7757 in ir_llvm::gen::execute
(this=this at entry=0x7fffffffd1d0, m=..., sc="") at src/ir/llvm/gen.cpp:252
#10 0x000000000041736b in runner::execute
(this=this at entry=0x7fffffffdbc0, m=std::shared_ptr (count 2, weak 0)
0x682200) at src/bin/leaf.cpp:544
#11 0x0000000000415ac8 in main (argc=3, argv=0x7fffffffdde8) at
src/bin/leaf.cpp:265

-- 
edA-qa mort-ora-y 
http://mortoray.com/

Leaf - the language we always wanted
http://leaflang.org/



More information about the llvm-dev mailing list