-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Compiler bug with @ccall
and parametric types
#57023
Comments
@call
and parametric types@ccall
and parametric types
Type parameters in ccall signatures are only partially supported. The reason for that is that (as in this case) it's usually incorrect to use them there. In particular, the signature of jl_malloc does not change. It always returns a Ptr{Void} that them needs to be casted. The types in a ccall signature need to match the c declaration exactly - everything else is UB. |
Note that this example ran correctly before inlining, then there was a bug introduced to make the example crash |
Previously didn't handle ccall or cfunction that were assigned to a variable. Required for inlining correctness. Fixes #57023
Previously didn't handle ccall or cfunction that were assigned to a variable. Required for inlining correctness. Fixes #57023
Following from this discussion on the discourse
A summary of the problem is:
Here is a full minimal working example of the problem:
Note that this works fine if one of the following:
Table
@ccall
specifies a return typePtr{Cvoid}
, and thenunsafe_convert
s toPtr{T}
The underlying problem was then found by @Seelengrab as discussed at the end of the discourse post
The text was updated successfully, but these errors were encountered: