-
Notifications
You must be signed in to change notification settings - Fork 44
Closed
Description
julia> using OffsetArrays
julia> o = OffsetArray([2,2,3],-1:1)
3-element OffsetArray(::Array{Int64,1}, -1:1) with eltype Int64 with indices -1:1:
2
2
3
julia> searchsorted(o,1)
Segmentation fault: 11
Using the debugger reveals its a strange bug:
julia> @enter searchsorted(o,1)
In #searchsorted#6(lt, by, rev, order, , v, x) at sort.jl:296
>1 1 ─ %1 = (Base.Order.ord)(lt, by, rev, order)
2 │ %2 = (searchsorted)(v, x, %1)
3 └── return %2
About to run: (Base.Order.ord)(isless, identity, nothing, Base.Order.ForwardOrdering())
1|debug> n
ERROR: BoundsError: attempt to access 3-element OffsetArray(::Array{Int64,1}, -1:1) with eltype Int64 with indices -1:1 at index [9223372036854775807]
Stacktrace:
[1] throw_boundserror(::OffsetArray{Int64,1,Array{Int64,1}}, ::Tuple{Int64}) at abstractarray.jl:538
[2] checkbounds(::OffsetArray{Int64,1,Array{Int64,1}}, ::Tuple{Int64}) at abstractarray.jl:503
[3] getindex(::OffsetArray{Int64,1,Array{Int64,1}}, ::Int64) at /Users/solver/.julia/packages/OffsetArrays/vIbpP/src/OffsetArrays.jl:135
[4] searchsorted(::OffsetArray{Int64,1,Array{Int64,1}}, ::Int64, ::Int64, ::Int64, ::Base.Order.ForwardOrdering) at sort.jl:214
[5] searchsorted(::OffsetArray{Int64,1,Array{Int64,1}}, ::Int64, ::Base.Order.ForwardOrdering) at sort.jl:294
[6] #searchsorted#6(::typeof(isless), ::typeof(identity), ::Nothing, ::Base.Order.ForwardOrdering, ::typeof(searchsorted), ::OffsetArray{Int64,1,Array{Int64,1}}, ::Int64) at sort.jl:296
[7] searchsorted(::OffsetArray{Int64,1,Array{Int64,1}}, ::Int64) at sort.jl:296
PS I want this to support offset BlockArray
s: JuliaArrays/BlockArrays.jl#95
Metadata
Metadata
Assignees
Labels
No labels