From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6465 invoked by alias); 24 Sep 2011 21:54:07 -0000 Received: (qmail 6454 invoked by uid 22791); 24 Sep 2011 21:54:05 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 24 Sep 2011 21:53:52 +0000 From: "john.salmon at deshaw dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/50510] New: transposed variable names in std::seed_seq::generate Date: Sat, 24 Sep 2011 22:35: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-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: john.salmon at deshaw dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2011-09/txt/msg01772.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50510 Bug #: 50510 Summary: transposed variable names in std::seed_seq::generate Classification: Unclassified Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: john.salmon@deshaw.com The C++11 "Final Draft International Standard" (FDIS n3290.pdf) fixes a defect in the "Final Committee Draft" (FCD n3092.pdf), swapping the use of the intermediate variables r3 and r4 in the std::seed_seq::generate() function. See 25.5.7.1 paragraph 8c. This patch brings libstdc++ up-to-date: salmonj@drdlogin0039.en.desres$ diff -u oldrandom.tcc random.tcc --- oldrandom.tcc 2011-09-19 10:04:46.836512000 -0400 +++ random.tcc 2011-09-24 17:45:02.879621416 -0400 @@ -2796,8 +2796,8 @@ _Type __r4 = __r3 - __k % __n; __r4 = __detail::__mod<_Type, __detail::_Shift<_Type, 32>::__value>(__r4); - __begin[(__k + __p) % __n] ^= __r4; - __begin[(__k + __q) % __n] ^= __r3; + __begin[(__k + __p) % __n] ^= __r3; + __begin[(__k + __q) % __n] ^= __r4; __begin[__k % __n] = __r4; } } salmonj@drdlogin0039.en.desres$