Skip to content
Snippets Groups Projects
Commit cecd5f2f authored by Jishnu Bhattacharya's avatar Jishnu Bhattacharya Committed by KristofferC
Browse files

Fix indexing in _mapreducedim for OffsetArrays (#55506)


The destination array was being indexed incorrectly if it had offset
indices. This led to the following on nightly:
```julia
julia> using OffsetArrays

julia> r = 5:100;

julia> a = OffsetVector(r, 2);

julia> sum(a, dims=1)
1-element OffsetArray(::Vector{Int64}, 3:3) with eltype Int64 with indices 3:3:
 0

julia> sum(a)
5040
```
The indexing was marked `@inbounds`, so this was not throwing an error.
This PR also follows #55329 and only marks the indexing operations as
`@inbounds`, omitting the function calls.

---------

Co-authored-by: default avatarMatt Bauman <mbauman@juliahub.com>
(cherry picked from commit 3d20a921)
parent 4d46082a
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment