[LLVMdev] Problem executing code with lli...

Karhu, Abhinav R akarhu3 at gatech.edu
Wed Oct 29 19:21:08 PDT 2008

Hi all,
I am facing new problem with lli now. I am having a sample code in which I am doing malloc for two variables. If I compile the code with normal gcc the program runs without any warning of any sorts. If I compile the program to convert it into a bytecode file and then run it through lli it segfaults and the program aborts. This is the stack trace after execution.
lli((anonymous namespace)::PrintStackTrace()+0x1f)[0x67cc7f]
lli((anonymous namespace)::SignalHandler(int)+0x172)[0x67cf72]
lli(llvm::ExecutionEngine::LoadValueFromMemory(llvm::GenericValue*, llvm::Type const*)+0x182)[0x4be4f2]
lli(llvm::InstVisitor<llvm::Interpreter, void>::visit(llvm::Instruction&)+0x1fe)[0x4b648e]
lli(llvm::Interpreter::runFunction(llvm::Function*, std::vector<llvm::GenericValue, std::allocator<llvm::GenericValue> > const&)+0xac)[0x4b490c]
lli(llvm::ExecutionEngine::runFunctionAsMain(llvm::Function*, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, char const* const*)+0xa5)[0x4bf295]
Segmentation fault

I am also testing to see if the malloc was successful or not and it shows that malloc was successful. 

The part where is static memory is allocated runs fine(I am putting a print for that value). Why is the program failing in LoadValueFromMemory?

Please some light on this issue.


Abhinav Karhu
MS Computer Science
Georgia Institute of Technology

More information about the llvm-dev mailing list