Describe the Bug
Hello,
I'm trying to emit a simple malloc call but I get a segfault when the call is made, before even returning from the malloc. It compile correctly, but crash on run in a JIT
With a code as simple as that
let malloc = self
.builder_main
.build_malloc(self.context.custom_width_int_type(8), "malloc")
.expect("call malloc");
with nothing else being compiled, I get the following opcode
call: ; No predecessors!
%malloc = tail call ptr @malloc(i32 ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i32))
ret void
}
As we can see there's a getelementptr (i8, ptr null, i32 1) which I think might cause the issue.
I tried i8_type or different name but the result is always the same. I tried to add a free instruction after that but it doesn't reach the free on run.
LLVM Version:
inkwell = { version = "0.5.0", features = ["llvm18-0"] }
llvm-sys-180 = { package = "llvm-sys", version = "180.0.0", features = [
"prefer-static",
] }
Desktop (please complete the following information):
Describe the Bug Hello, I'm trying to emit a simple malloc call but I get a segfault when the call is made, before even returning from the malloc. It compile correctly, but crash on run in a JIT
With a code as simple as that
with nothing else being compiled, I get the following opcode
As we can see there's a
getelementptr (i8, ptr null, i32 1)
which I think might cause the issue.I tried i8_type or different name but the result is always the same. I tried to add a
free
instruction after that but it doesn't reach thefree
on run.LLVM Version: inkwell = { version = "0.5.0", features = ["llvm18-0"] } llvm-sys-180 = { package = "llvm-sys", version = "180.0.0", features = [ "prefer-static", ] }
Desktop (please complete the following information):