-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
compiler: fix llvmcall segfault with zero-sized types #60111
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
base: master
Are you sure you want to change the base?
Changes from 2 commits
ea78ccf
b955f00
16e8b2b
ffc010f
376400d
ccbc646
6a02513
ea18a59
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -909,6 +909,11 @@ static jl_cgval_t emit_llvmcall(jl_codectx_t &ctx, jl_value_t **args, size_t nar | |
| jl_value_t *tti = jl_svecref(tt,i); | ||
| bool toboxed; | ||
| Type *t = julia_type_to_llvm(ctx, tti, &toboxed); | ||
| if (jl_is_datatype(tti) && jl_datatype_size((jl_datatype_t*)tti) == 0) { | ||
| emit_error(ctx, "llvmcall does not support zero-sized argument types"); | ||
| JL_GC_POP(); | ||
| return jl_cgval_t(); | ||
| } | ||
| argtypes.push_back(t); | ||
| if (4 + i > nargs) { | ||
| emit_error(ctx, "Missing arguments to llvmcall!"); | ||
|
|
@@ -927,6 +932,11 @@ static jl_cgval_t emit_llvmcall(jl_codectx_t &ctx, jl_value_t **args, size_t nar | |
| jl_value_t *rtt = rt; | ||
| bool retboxed; | ||
| Type *rettype = julia_type_to_llvm(ctx, rtt, &retboxed); | ||
| if (jl_is_datatype(rtt) && jl_datatype_size((jl_datatype_t*)rtt) == 0) { | ||
| emit_error(ctx, "llvmcall does not support zero-sized return types"); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added a check for that
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The semantics here of checking if the user made an egregious typo are still wrong. This is also well formed: This sort of random checking for user error doesn't really make sense to me. The point of llvmcall is an unsafe escape hatch into unsafe territory. If you don't like that, just don't use it. |
||
| JL_GC_POP(); | ||
| return jl_cgval_t(); | ||
| } | ||
|
|
||
| // Make sure to find a unique name | ||
| std::string ir_name; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.