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

assertion failure on uncertain ccall return type #5752

Closed
vtjnash opened this issue Feb 10, 2014 · 2 comments
Closed

assertion failure on uncertain ccall return type #5752

vtjnash opened this issue Feb 10, 2014 · 2 comments
Assignees
Labels
kind:bug Indicates an unexpected problem or unintended behavior

Comments

@vtjnash
Copy link
Sponsor Member

vtjnash commented Feb 10, 2014

julia> h{T}(::Type{T}) = ccall(:time, Ptr{T.parameters[1]}, (Int,), 0)+1
h (generic function with 1 method)

julia> h(Vector{Int})
Assertion failed: ("Don't know how to box this type" && false), function boxed, file ./cgutils.cpp, line 1522.

This happens because ccall returns an unboxed Ptr{Int}, but codegen doesn't quite know what to expect when it goes to box it (inference told it to expect Ptr{T})

@vtjnash vtjnash added the bug label Feb 10, 2014
@JeffBezanson
Copy link
Sponsor Member

Type inference can be made to handle this case, but we also need better (error) handling of cases like

h{T}(::Type{T}) = ccall(:time, Ptr{randbool()?Int8:Int16}, (Int,), 0)+1

@JeffBezanson
Copy link
Sponsor Member

I consider this fixed since the code now works; improving type inference here is a separate matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants