Skip to content

sort_index returns incorrect results with GCC 13 #243

Description

@ankane

Hi, the sort_index method returns incorrect results with GCC 13 (the default for Ubuntu 24.04).

Repro script

require "numo/narray"

3.times do
  arr = Numo::SFloat.new(1000).rand
  indexes = arr.sort_index
  result = arr[indexes[0..4]]
  p result if result.to_a != result.to_a.sort
end

Output

Numo::SFloat(view)#shape=[5]
[0.000451068, 0.00365162, 0.00525034, 0.00696475, 0.00320271]
Numo::SFloat(view)#shape=[5]
[3.87633e-05, 0.00209275, 0.0235566, 0.00297531, 0.004504]

The issue doesn't occur with GCC 11 on Ubuntu 22.04, or Clang 17 on Mac.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions