This is the mail archive of the
mailing list for the libstdc++ project.
Re: [patch] libstdc++/59603 Prevent self-swapping in random_shuffle
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Wed, 1 Oct 2014 13:35:10 +0100
- 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>
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
Now committed to the 4.9 branch (without the comment Chris didn't
* include/bits/stl_algo.h (random_shuffle): Prevent self-swapping.
* testsuite/25_algorithms/random_shuffle/59603.cc: New.