This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/49553] New: mt19937 number generator is broken on 64bit systems


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

           Summary: mt19937 number generator is broken on 64bit systems
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: boris@dolgov.name


Created attachment 24609
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24609
Test case program

Hello!

On 64bit-platforms std::tr1::uniform_int with use of mt19937 gives absolutely
not uniform distribution. I have attached a testcase to reproduce the bug.

The expected behaviour:
[boris@vaioz gcc-bug]$ ./test-case 
Got upperbound: 18445007523721859962
Expected upperbound: 18446744073709551615

Actual behaviour:
[boris@vaioz gcc-bug]$ ./test-case 
Got upperbound: 4294964877
Expected upperbound: 18446744073709551615

My system is Fedora 15.
gcc -v:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.6.0/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin
--enable-java-awt=gtk --disable-dssi
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-ppl --with-cloog --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.6.0 20110530 (Red Hat 4.6.0-9) (GCC) 

uname -a:
[boris@vaioz gcc-bug]$ uname -a
Linux vaioz 2.6.39-1.fc15.x86_64 #1 SMP Fri May 27 18:02:25 MSD 2011 x86_64
x86_64 x86_64 GNU/Linux

compile command:
g++ -o test-case test-case.cpp


As far as I understand, this happens because of passing an incorrect state_size
parameter to mersenne_twister template.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]