public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/50509] New: incorrect code in std::seed_seq::generate
@ 2011-09-24 18:14 john.salmon at deshaw dot com
2011-09-24 18:29 ` [Bug libstdc++/50509] [C++0x] " paolo.carlini at oracle dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: john.salmon at deshaw dot com @ 2011-09-24 18:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50509
Bug #: 50509
Summary: incorrect code 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 implementation of std::seed_seq::generate contains two typos. The code
uses '<<' where the standard in rand.util.seed_seq 26.5.7.1 paragraph 8 says:
T(x) is defined as x xor (x rshift 27)
Here's a patch against the 4.6.1 tree:
salmonj@drdlogin0039.en.desres$ diff -u
/proj/desres/root/Linux/x86_64/gcc/4.6.1-23A/include/c++/4.6.1/bits/random.tcc
myrandom/bits/random.tcc
---
/proj/desres/root/Linux/x86_64/gcc/4.6.1-23A/include/c++/4.6.1/bits/random.tcc
2011-06-27 15:29:53.000000000 -0400
+++ myrandom/bits/random.tcc 2011-09-19 10:04:46.836512000 -0400
@@ -2768,7 +2768,7 @@
_Type __arg = (__begin[__k % __n]
^ __begin[(__k + __p) % __n]
^ __begin[(__k - 1) % __n]);
- _Type __r1 = __arg ^ (__arg << 27);
+ _Type __r1 = __arg ^ (__arg >> 27);
__r1 = __detail::__mod<_Type, __detail::_Shift<_Type, 32>::__value,
1664525u, 0u>(__r1);
_Type __r2 = __r1;
@@ -2790,7 +2790,7 @@
_Type __arg = (__begin[__k % __n]
+ __begin[(__k + __p) % __n]
+ __begin[(__k - 1) % __n]);
- _Type __r3 = __arg ^ (__arg << 27);
+ _Type __r3 = __arg ^ (__arg >> 27);
__r3 = __detail::__mod<_Type, __detail::_Shift<_Type, 32>::__value,
1566083941u, 0u>(__r3);
_Type __r4 = __r3 - __k % __n;
salmonj@drdlogin0039.en.desres$
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/50509] [C++0x] incorrect code in std::seed_seq::generate
2011-09-24 18:14 [Bug libstdc++/50509] New: incorrect code in std::seed_seq::generate john.salmon at deshaw dot com
@ 2011-09-24 18:29 ` paolo.carlini at oracle dot com
2011-09-24 18:30 ` paolo at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-09-24 18:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50509
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2011-09-24
AssignedTo|unassigned at gcc dot |paolo.carlini at oracle dot
|gnu.org |com
Summary|incorrect code in |[C++0x] incorrect code in
|std::seed_seq::generate |std::seed_seq::generate
Ever Confirmed|0 |1
--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-09-24 18:13:32 UTC ---
Thanks, I'll commit the change momentarily.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/50509] [C++0x] incorrect code in std::seed_seq::generate
2011-09-24 18:14 [Bug libstdc++/50509] New: incorrect code in std::seed_seq::generate john.salmon at deshaw dot com
2011-09-24 18:29 ` [Bug libstdc++/50509] [C++0x] " paolo.carlini at oracle dot com
@ 2011-09-24 18:30 ` paolo at gcc dot gnu.org
2011-09-24 19:06 ` paolo.carlini at oracle dot com
2011-09-24 20:31 ` paolo at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: paolo at gcc dot gnu.org @ 2011-09-24 18:30 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50509
--- Comment #2 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2011-09-24 18:28:40 UTC ---
Author: paolo
Date: Sat Sep 24 18:28:36 2011
New Revision: 179144
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179144
Log:
2011-09-24 John Salmon <john.salmon@deshaw.com>
PR libstdc++/50509
* include/bits/random.tcc (seed_seq::generate): Fix computation.
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/bits/random.tcc
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/50509] [C++0x] incorrect code in std::seed_seq::generate
2011-09-24 18:14 [Bug libstdc++/50509] New: incorrect code in std::seed_seq::generate john.salmon at deshaw dot com
2011-09-24 18:29 ` [Bug libstdc++/50509] [C++0x] " paolo.carlini at oracle dot com
2011-09-24 18:30 ` paolo at gcc dot gnu.org
@ 2011-09-24 19:06 ` paolo.carlini at oracle dot com
2011-09-24 20:31 ` paolo at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-09-24 19:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50509
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.6.2
--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-09-24 18:29:18 UTC ---
Fixed for 4.6.2.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/50509] [C++0x] incorrect code in std::seed_seq::generate
2011-09-24 18:14 [Bug libstdc++/50509] New: incorrect code in std::seed_seq::generate john.salmon at deshaw dot com
` (2 preceding siblings ...)
2011-09-24 19:06 ` paolo.carlini at oracle dot com
@ 2011-09-24 20:31 ` paolo at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: paolo at gcc dot gnu.org @ 2011-09-24 20:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50509
--- Comment #3 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2011-09-24 18:28:51 UTC ---
Author: paolo
Date: Sat Sep 24 18:28:48 2011
New Revision: 179145
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179145
Log:
2011-09-24 John Salmon <john.salmon@deshaw.com>
PR libstdc++/50509
* include/bits/random.tcc (seed_seq::generate): Fix computation.
Modified:
branches/gcc-4_6-branch/libstdc++-v3/ChangeLog
branches/gcc-4_6-branch/libstdc++-v3/include/bits/random.tcc
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-09-24 18:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-24 18:14 [Bug libstdc++/50509] New: incorrect code in std::seed_seq::generate john.salmon at deshaw dot com
2011-09-24 18:29 ` [Bug libstdc++/50509] [C++0x] " paolo.carlini at oracle dot com
2011-09-24 18:30 ` paolo at gcc dot gnu.org
2011-09-24 19:06 ` paolo.carlini at oracle dot com
2011-09-24 20:31 ` paolo at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).