[llvm-dev] GenericValue of pointer becomes 0 when passed through RunFunction

Hakan Aras via llvm-dev llvm-dev at lists.llvm.org
Mon Dec 10 10:52:52 PST 2018


I'm trying to pass a function pointer to the LLVM interpreter, but when I print it in the llvm function it is null. I'm using the C API.

Here's the relevant code (It's in D):

https://pastebin.com/hSbdDpfa

and here's the output:

define void @fp_pass_test(void ()*) {
entry:
  %1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @0, i32 0, i32 0), void ()* %0)
  call void %0()
  ret void
}
passed ptr: 4142ddb0
unwrapped ptr: 4142ddb0
received ptr: 0
Program exited with code -11


Does anyone know why the pointer would become null after passing it through LLVMRunFunction?

Best Regards
Hakan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181210/a7066297/attachment.html>


More information about the llvm-dev mailing list