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

Type inference error #20305

Closed
yuyichao opened this issue Jan 28, 2017 · 0 comments · Fixed by #20115
Closed

Type inference error #20305

yuyichao opened this issue Jan 28, 2017 · 0 comments · Fixed by #20115
Labels
regression Regression in behavior compared to a previous version types and dispatch Types, subtyping and method dispatch

Comments

@yuyichao
Copy link
Contributor

PyCall test is causing a SIGILL due to what seems to be a type inference/type computation error. Reduced case:

data = Ptr{Float16}(Libc.malloc(1000))
dims = (6, 1)
function copy2(data)
    B = unsafe_wrap(Array, data, dims::Tuple)
    return transpose(B)
end
@code_warntype copy2(data)
copy2(data)

The inferred code is

Variables:
  #self#::#copy2
  data::Ptr{Float16}
  B::Union{Array{Float16,N},Array{Float16,N}}
  #temp#::Core.MethodInstance

Body:
  begin 
      B::Union{Array{Float16,N},Array{Float16,N}} = (Main.unsafe_wrap)(Main.Array,data::Ptr{Float16},(Core.typeassert)(Main.dims,Main.Tuple)::Tuple)::Union{Array{Float16,N},Array{Float16,N}} # line 7:
      return (Main.transpose)(B::Union{Array{Float16,N},Array{Float16,N}})::Union{}
  end::Union{}

The inferred type of B looks weird and the inferred type of transpose is wrong.

Maybe it's related to failing to normalize these types?

julia> Union{Array{Float16,N},Array{Float16,N}} where N
Union{Array{Float16,N},Array{Float16,N}} where N

julia> Union{Array{Float16,N1},Array{Float16,N2}} where N1 where N2
Union{Array{Float16,N1},Array{Float16,N2}} where N1 where N2

@JeffBezanson

@yuyichao yuyichao added types and dispatch Types, subtyping and method dispatch regression Regression in behavior compared to a previous version labels Jan 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression Regression in behavior compared to a previous version types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant