Skip to content

copy!(::Memory{Int}, ::Vector{Int}) causes JET warnings #56634

Open
@nsajko

Description

@nsajko
julia> using JET

julia> report_opt(copy!, Tuple{Memory{Int}, Vector{Int}})
═════ 1 possible error found ═════
┌ copy!(dst::Memory{Int64}, src::Vector{Int64}) @ Base ./abstractarray.jl:914
│ runtime dispatch detected: resize!(dst::Memory{Int64}, %12::Int64)
└────────────────────


julia> report_call(copy!, Tuple{Memory{Int}, Vector{Int}})
═════ 1 possible error found ═════
┌ copy!(dst::Memory{Int64}, src::Vector{Int64}) @ Base ./abstractarray.jl:914
│ no matching method found `resize!(::Memory{Int64}, ::Int64)`: resize!(dst::Memory{Int64}, length(src::Vector{Int64})::Int64)
└────────────────────

Should copy! get a specialized method, given that it's not resizable?

The workaround is to call copyto! instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrays[a, r, r, a, y, s]

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions