I am trying to build a null pointer using LLVM build store instruction builder for the following piece of code:
int *x;
x = 0;
The problem that I am facing is that when assigning zero to x I am getting an incompatible type error as 0 is of i32 type and x is of i32** type. I am using LLVMPointerType to create a pointer type for zero and using it in the BuildStore builder but LLVMPointerType returns an LLVMTypeRef whereas BuildStore needs LLVMValueRef Type of argument. I am stuck not being able to type cast and could really use some help.
Also is there another way of creating a NULL pointer in LLVM?