From f5d15571b3f1745f7783509e336c4d9f7246cdd9 Mon Sep 17 00:00:00 2001 From: Valentin Churavy Date: Fri, 11 Mar 2022 12:10:29 -0500 Subject: [PATCH] [LLVM/ABI] Don't pass null pointer to byVal attribute (#44555) --- src/abi_x86_64.cpp | 1 - src/ccall.cpp | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/abi_x86_64.cpp b/src/abi_x86_64.cpp index 2a06ee6be36a6..43e539b8386ce 100644 --- a/src/abi_x86_64.cpp +++ b/src/abi_x86_64.cpp @@ -202,7 +202,6 @@ bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx, Type *T else if (jl_is_structtype(dt)) { // spill to memory even though we would ordinarily pass // it in registers - Type* Ty = preferred_llvm_type(dt, false, ctx); ab.addByValAttr(Ty); return true; } diff --git a/src/ccall.cpp b/src/ccall.cpp index 04d8b5525cd30..a7e8b0f4daa7c 100644 --- a/src/ccall.cpp +++ b/src/ccall.cpp @@ -1098,6 +1098,7 @@ std::string generate_func_sig(const char *fname) } // Whether or not LLVM wants us to emit a pointer to the data + assert(t && "LLVM type should not be null"); bool byRef = abi->needPassByRef((jl_datatype_t*)tti, ab, LLVMCtx, t); if (jl_is_cpointer_type(tti)) {