This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] libstdc++/59603 Prevent self-swapping in random_shuffle
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Jonathan Wakely <jwakely at redhat dot com>
- Cc: "libstdc++" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 6 Dec 2014 22:04:38 +0000
- Subject: Re: [patch] libstdc++/59603 Prevent self-swapping in random_shuffle
- Authentication-results: sourceware.org; auth=none
- References: <20140912133452 dot GN22778 at redhat dot com> <20141001123510 dot GO4197 at redhat dot com>
On 1 October 2014 at 13:35, Jonathan Wakely <jwakely@redhat.com> wrote:
> On 12/09/14 14:34 +0100, Jonathan Wakely wrote:
>>
>> Swapping an object with itself is pointless, and asserts in debug mode
>> (but we should probably remove that check from debug mode, since it
>> can happen in reasonable code).
>>
>> Tested x86_64-linux, committed to trunk.
>>
>> I think this makes sense for the branches too, so will backport it
>> soon.
>
>
> Now committed to the 4.9 branch (without the comment Chris didn't
> like).
>
>> PR libstdc++/59603
>> * include/bits/stl_algo.h (random_shuffle): Prevent self-swapping.
>> * testsuite/25_algorithms/random_shuffle/59603.cc: New.
>
>
>
And also to the 4.8 branch.