Opened 6 years ago

Last modified 4 years ago

#12821 new Bugs

Crash in integer_sort when reverse sorting a struct

Reported by: Domagoj Šarić Owned by: Paul A. Bristow
Milestone: To Be Determined Component: sort
Version: Boost 1.63.0 Severity: Showstopper
Keywords: 1 Cc: arachni@…

Description (last modified by Domagoj Šarić)

I have a custom 'zip' iterator (that iterates over two arrays):

  • its value_type = std::pair<std::uint32_t, T>
  • its reference = std::pair<std::uint32_t &, T &>.

I want to reverse sort these two arrays so I do:

auto const comparator( []( auto const & left, auto const & right ) noexcept { return left.first > right.first; } );
auto const rightshift{ []( custom_iterator::reference const x, unsigned const offset ) noexcept { return x.first >> offset; } };

...but there is a crash in integer_sort in this case (if I do a 'normal' less-than compare, i.e. not a reversed sort) then it works...

Change History (4)

comment:1 by Domagoj Šarić, 6 years ago

Description: modified (diff)

comment:2 by Domagoj Šarić, 6 years ago

Description: modified (diff)

comment:3 by Domagoj Šarić, 6 years ago

Description: modified (diff)

in reply to:  1 comment:4 by arachni_name <arachni@…>, 4 years ago

Cc: arachni@… added
Keywords: 1 added

1"'`--

Note: See TracTickets for help on using tickets.