[LLVMdev] Segmentation fault - Kaleidoscope

Paul Melis
2009-06-17T16:46:03Z

FWIW, I'm also suddenly experiencing segfaults in code that used to work
a few days ago (I'm using svn). This may be unrelated to the problem
described below, but perhaps it's the same thing.

In my case it seems that creating an ExecutionEngine has changed. I used
to do

    Module* Mod = makeLLVMModule();      // basically create a gcd function
    verifyModule(*Mod, PrintMessageAction);

    ExecutionEngine *EE;
    EE = ExecutionEngine::create(Mod);

but I now get 0x0 for EE. The compile command I'm using is

g++ -O3 -I ~/llvm/include/ -L ~/llvm bug.cpp `llvm-config --cxxflags
--ldflags --libs core jit native` -o bug

I noticed something very recently changed w.r.t. the way LLVM's
libraries are built (no more .o files). Could this have something to
with it?

Regards,
Paul


Juan Carlos Martinez Santos wrote:
> Hello,
>
> Following the tutorial "Kaleidoscope: Adding JIT and Optimizer
> Support", I found a Segmentation fault when I try to execute it. I am
> new in the neighbourhood, so I don't know what is wrong. Could you
> help me with that?
>
> I am working with the last version of LLVM (2.5). The code in chapter
> 2 and 3 works good, but the code in the chapter 4 did not work.
>
> Below are the detail of what I did.
>
> Regards,
>
> Juan Carlos
>
> *********************************
> http://llvm.org/docs/tutorial/LangImpl4.html#jit
>
> *********************************
> ./toy
> ready> 4+5;
> Segmentation fault
>
> *********************************
> Details using gdb:
> *********************************
> [New Thread 0xb7ca96c0 (LWP 9948)]
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0xb7ca96c0 (LWP 9948)]
> 0x0804e914 in main ()
>     at /usr/local/include/llvm/ExecutionEngine/ExecutionEngine.h:142
> 142      const TargetData *getTargetData() const { return TD; }
>
>
> --
> Juan Carlos
> ------------------------------------------------------------------------
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>