Hi,

On 10/19/2013 11:02 PM, Christopher Jefferson wrote:
A previous fix to a performance problem in std::sort unfortunately has
lead to a crashing bug in std::nth_element.

The following minimal patch fixes the problem (there are a couple of
different ways of fixing it, this is the shortest and safest).

2013-09-19 Chris Jefferson <ch...@bubblescope.net>

PR libstdc++/58800
* include/bits/stl_algo.h (__unguarded_partition_pivot) : Change
__last - 2 to __last - 1, so we correctly work on arrays of length 4.
* testsuite/25_algorithms/nth_element/58800.cc : New
I have this already applied in my local svn branches and can apply it later today (I fixed the Copyright years to only 2013 of course and reformatted a bit the rest of the testcase)

Thanks!
Paolo.

Reply via email to