Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LLVM/ABI] Don't pass null pointer to byVal attribute #44555

Merged
merged 2 commits into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/abi_x86_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions src/ccall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down