From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4470 invoked by alias); 26 Dec 2013 16:36:29 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 4448 invoked by uid 48); 26 Dec 2013 16:36:22 -0000 From: "fab at orlen dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/59603] New: std::random_shuffle tries to swap element with itself Date: Thu, 26 Dec 2013 16:36:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 4.8.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: fab at orlen dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-12/txt/msg02206.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59603 Bug ID: 59603 Summary: std::random_shuffle tries to swap element with itself Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: fab at orlen dot de When using the debugging macro _GLIBCXX_DEBUG, calling random_shuffle fails on some types, because it might try to swap an element with itself. Output of attached program: /tmp$ g++ -o random_shuffle_bug -std=c++11 random_shuffle_bug.cc /tmp$ ./random_shuffle_bug /usr/include/c++/4.8.2/debug/vector:159:error: attempt to self move assign. Objects involved in the operation: sequence "this" @ 0x0xa600c8 { type = NSt7__debug6vectorIiSaIiEEE; } Aborted (core dumped) return code: 134 I could not find any information about whether swapping an element with itself is allowed.