Skip to content

Commit c922b24

Browse files
jit: Create void type in the right context
Commit 3b991f8 introduced a specific context for types such that all no longer referenced types can be dropped periodically rather than leaking. One void pointer type creation was however missed leading to an assertion failure in LLVM Debug builds. Per buildfarm members canebreak and urutu. Fix with assistance from Andres. The codepath in question was refactored in version 13 hence why this only affected version 12. Reported-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/1106876.1700409912@sss.pgh.pa.us
1 parent e81e617 commit c922b24

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/backend/jit/llvm/llvmjit_expr.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2620,15 +2620,17 @@ build_EvalXFunc(LLVMBuilderRef b, LLVMModuleRef mod, const char *funcname,
26202620
LLVMValueRef v_fn;
26212621
LLVMTypeRef param_types[3];
26222622
LLVMValueRef params[3];
2623+
LLVMContextRef lc;
26232624

2625+
lc = LLVMGetModuleContext(mod);
26242626
v_fn = LLVMGetNamedFunction(mod, funcname);
26252627
if (!v_fn)
26262628
{
26272629
param_types[0] = l_ptr(StructExprState);
26282630
param_types[1] = l_ptr(StructExprEvalStep);
26292631
param_types[2] = l_ptr(StructExprContext);
26302632

2631-
sig = LLVMFunctionType(LLVMVoidType(),
2633+
sig = LLVMFunctionType(LLVMVoidTypeInContext(lc),
26322634
param_types, lengthof(param_types),
26332635
false);
26342636
v_fn = LLVMAddFunction(mod, funcname, sig);

0 commit comments

Comments
 (0)