Skip to content

map! resulting in undefined values  #36235

@goretkin

Description

@goretkin
julia> VERSION
v"1.5.0-beta1.0"

julia> map!(+, [0,0,0], [1,2], [10,20,30], [100])
3-element Array{Int64,1}:
 111
  31
   0

julia> map!(+, [0,0,0], [1,2], [10,20,30], [100])
3-element Array{Int64,1}:
        111
 4616658790
          0

This also happened on v1.4.1

Pretty sure this commit removed the necessary bounds check: f9645ff

Probably, if @boundscheck LinearIndices(dest) == idxs1 && all(x -> LinearIndices(x) == idxs1, As) evaluates to false, then BoundsError should be thrown.

If I understand the intent correct, map!(+, [0,0,0], [1,2], [10,20,30], [100]) is supposed to error because the trailing arguments don't match the axes of the second argument. Or at the very least because the last argument is smaller than the second argument.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorcorrectness bug ⚠Bugs that are likely to lead to incorrect results in user code without throwing

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions