public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/55215] New: Constructor seeding is broken for Mersenne twister
@ 2012-11-05 16:14 wgh at beyondunreal dot com
  2012-11-05 16:15 ` [Bug libstdc++/55215] " wgh at beyondunreal dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: wgh at beyondunreal dot com @ 2012-11-05 16:14 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55215

             Bug #: 55215
           Summary: Constructor seeding is broken for Mersenne twister
    Classification: Unclassified
           Product: gcc
           Version: 4.6.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: wgh@beyondunreal.com


http://ideone.com/p8B7lF (the code is also provided in attachment).

I expected that both functions, f and g, would return the same value every
time. But, as we can see, initializing Mersenne using its constructor doesn't
yield consistent results.

I tested compiler from Visual Studio 2012, and it doesn't have this bug. Other
random number engines probably don't have this bug (I tested std::minstd_rand).


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libstdc++/55215] Constructor seeding is broken for Mersenne twister
  2012-11-05 16:14 [Bug libstdc++/55215] New: Constructor seeding is broken for Mersenne twister wgh at beyondunreal dot com
@ 2012-11-05 16:15 ` wgh at beyondunreal dot com
  2012-11-05 17:44 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: wgh at beyondunreal dot com @ 2012-11-05 16:15 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55215

--- Comment #1 from wgh at beyondunreal dot com 2012-11-05 16:15:06 UTC ---
Created attachment 28619
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28619
reproduction


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libstdc++/55215] Constructor seeding is broken for Mersenne twister
  2012-11-05 16:14 [Bug libstdc++/55215] New: Constructor seeding is broken for Mersenne twister wgh at beyondunreal dot com
  2012-11-05 16:15 ` [Bug libstdc++/55215] " wgh at beyondunreal dot com
@ 2012-11-05 17:44 ` paolo.carlini at oracle dot com
  2012-11-05 19:25 ` paolo at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-05 17:44 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55215

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2012-11-05
         AssignedTo|unassigned at gcc dot       |paolo.carlini at oracle dot
                   |gnu.org                     |com
   Target Milestone|---                         |4.7.3
     Ever Confirmed|0                           |1

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-05 17:44:02 UTC ---
It's a stupid uninitialized variable. Will fix momentarily.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libstdc++/55215] Constructor seeding is broken for Mersenne twister
  2012-11-05 16:14 [Bug libstdc++/55215] New: Constructor seeding is broken for Mersenne twister wgh at beyondunreal dot com
  2012-11-05 16:15 ` [Bug libstdc++/55215] " wgh at beyondunreal dot com
  2012-11-05 17:44 ` paolo.carlini at oracle dot com
@ 2012-11-05 19:25 ` paolo at gcc dot gnu.org
  2012-11-05 20:12 ` paolo at gcc dot gnu.org
  2012-11-05 20:12 ` paolo.carlini at oracle dot com
  4 siblings, 0 replies; 6+ messages in thread
From: paolo at gcc dot gnu.org @ 2012-11-05 19:25 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55215

--- Comment #3 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2012-11-05 19:25:27 UTC ---
Author: paolo
Date: Mon Nov  5 19:25:20 2012
New Revision: 193181

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193181
Log:
2012-11-05  Paolo Carlini  <paolo.carlini@oracle.com>

    PR libstdc++/55215
    * include/bits/random.tcc (mersenne_twister_engine<>::seed(_Sseq&)):
    Assign state_size to _M_p.
    * testsuite/26_numerics/random/mersenne_twister_engine/cons/55215.cc:
    New.
    * testsuite/26_numerics/random/independent_bits_engine/cons/55215.cc:
    Likewise.
    * testsuite/26_numerics/random/shuffle_order_engine/cons/55215.cc:
    Likewise.
    * testsuite/26_numerics/random/subtract_with_carry_engine/cons/
    55215.cc: Likewise.
    * testsuite/26_numerics/random/discard_block_engine/cons/55215.cc:
    Likewise.
    * testsuite/26_numerics/random/linear_congruential_engine/cons/
    55215.cc: Likewise.

Added:
   
trunk/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/55215.cc
   
trunk/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/55215.cc
   
trunk/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/55215.cc
   
trunk/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/55215.cc
   
trunk/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/55215.cc
   
trunk/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/55215.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/random.tcc


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libstdc++/55215] Constructor seeding is broken for Mersenne twister
  2012-11-05 16:14 [Bug libstdc++/55215] New: Constructor seeding is broken for Mersenne twister wgh at beyondunreal dot com
                   ` (3 preceding siblings ...)
  2012-11-05 20:12 ` paolo at gcc dot gnu.org
@ 2012-11-05 20:12 ` paolo.carlini at oracle dot com
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-05 20:12 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55215

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-05 20:12:42 UTC ---
Fixed mainline and 4.7.3.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libstdc++/55215] Constructor seeding is broken for Mersenne twister
  2012-11-05 16:14 [Bug libstdc++/55215] New: Constructor seeding is broken for Mersenne twister wgh at beyondunreal dot com
                   ` (2 preceding siblings ...)
  2012-11-05 19:25 ` paolo at gcc dot gnu.org
@ 2012-11-05 20:12 ` paolo at gcc dot gnu.org
  2012-11-05 20:12 ` paolo.carlini at oracle dot com
  4 siblings, 0 replies; 6+ messages in thread
From: paolo at gcc dot gnu.org @ 2012-11-05 20:12 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55215

--- Comment #4 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2012-11-05 20:11:44 UTC ---
Author: paolo
Date: Mon Nov  5 20:11:32 2012
New Revision: 193183

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193183
Log:
2012-11-05  Paolo Carlini  <paolo.carlini@oracle.com>

    PR libstdc++/55215
    * include/bits/random.tcc (mersenne_twister_engine<>::seed(_Sseq&)):
    Assign state_size to _M_p.
    * testsuite/26_numerics/random/mersenne_twister_engine/cons/55215.cc:
    New.
    * testsuite/26_numerics/random/independent_bits_engine/cons/55215.cc:
    Likewise.
    * testsuite/26_numerics/random/shuffle_order_engine/cons/55215.cc:
    Likewise.
    * testsuite/26_numerics/random/subtract_with_carry_engine/cons/
    55215.cc: Likewise.
    * testsuite/26_numerics/random/discard_block_engine/cons/55215.cc:
    Likewise.
    * testsuite/26_numerics/random/linear_congruential_engine/cons/
    55215.cc: Likewise.

Added:
   
branches/gcc-4_7-branch/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/55215.cc
   
branches/gcc-4_7-branch/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/55215.cc
   
branches/gcc-4_7-branch/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/55215.cc
   
branches/gcc-4_7-branch/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/55215.cc
   
branches/gcc-4_7-branch/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/55215.cc
   
branches/gcc-4_7-branch/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/55215.cc
Modified:
    branches/gcc-4_7-branch/libstdc++-v3/ChangeLog
    branches/gcc-4_7-branch/libstdc++-v3/include/bits/random.tcc


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-11-05 20:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-05 16:14 [Bug libstdc++/55215] New: Constructor seeding is broken for Mersenne twister wgh at beyondunreal dot com
2012-11-05 16:15 ` [Bug libstdc++/55215] " wgh at beyondunreal dot com
2012-11-05 17:44 ` paolo.carlini at oracle dot com
2012-11-05 19:25 ` paolo at gcc dot gnu.org
2012-11-05 20:12 ` paolo at gcc dot gnu.org
2012-11-05 20:12 ` paolo.carlini at oracle dot com

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).