Skip to content

partialsort! is broken for UnwrappableSubArray with non-zero offset on 1.11 #59569

@N5N3

Description

@N5N3

MWE

julia> a = reshape(6000:-1:1, 1000, :) |> collect;

julia> bad = partialsort!(view(copy(a), :, 6), 500:501)
2-element view(::Matrix{Int64}, 500:501, 6) with eltype Int64:
 546
 545

julia> good = partialsort(view(copy(a), :, 6), 500:501)
2-element view(::Vector{Int64}, 500:501) with eltype Int64:
 500
 501

julia> versioninfo()
Julia Version 1.12.0-rc2
Commit 72cbf019d0 (2025-09-06 12:00 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 16 × 12th Gen Intel(R) Core(TM) i7-12650H
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, alderlake)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 16 virtual cores)

Looks like SubArrayOptimization fails to pass the offset change into the inner Algorithm.
CC @LilithHafner

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorregression 1.11Regression in the 1.11 releasesortingPut things in order

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions