[LLVMdev] problem with llvmgcc and lli

Xiaodong Li xli3 at csil-suna37.cs.uiuc.edu
Fri Nov 1 15:05:02 PST 2002

Finally lli and llvmgcc can work under my directory. I wrote the following
simple program and compiled it using gcc and then run it without any
problem.  But when I tried to compile it using llvmgcc and lli, llvmgcc
gave me the following error message which I cannot understand:

xli3|csil-suna37|~/cs426|[181]% llvmgcc test.c -o test
test.c: In function `init':
test.c:10: warning: cast to pointer from integer of different size

When I run it using lli, it even gave me the following segmentation fault:
EXCEPTION OCCURRED [Segmentation Fault]:
>#0. int "main"()
        store uint 1, uint* %cast216
Breakpoint hit!
#5      store uint 1, uint* %cast216
#5      store uint 1, uint* %cast216

Could you please let me know what's wrong with this program? The program
is attached as follows:


#include <stdio.h>

struct a {
        int b;
        int c;

struct a  *init( )
        struct a *tmp = (struct a *)malloc(sizeof(struct a));

                                return tmp;

int main()
        struct a *h;

        h = init();

        h->b = 1;
        h->c = 2 + h->b;

        printf("%d, %d\n", h->b, h->c);


More information about the llvm-dev mailing list