mpz_class possible bug
Peter MALKIN
malkin at core.ucl.ac.be
Mon Oct 2 10:44:20 CEST 2006
Dear GMP Developers,
I have encountered a problem when compiling a small c++ program using
gmp version 4.2.1. My machine is a pentium 4 running Mandriva Linux.
You will find below more information on the configuration of my
machine. I downloaded the source code from the website
http://www.swox.com/gmp/. I ran `./configure' (without giving any
options to configure), `make', and `make check' (all tests passed). But
when I compile and run the small program (see attached) the output is
incorrect.
I compiled the program using g++ without any options.
`g++ -lgmpxx -lgmp gmpbug.cpp'
The output of the program should be as follows:
a = 12 b = 4 c = 3
a - b*c = 0
b = a - b*c
b = 0
However, the output of the program is as follows:
a = 12 b = 4 c = 3
a - b*c = 0
b = a - b*c
b = -24
The bug does not seem to occur in version 4.1.4. Also, I get the same
incorrect output using version 4.2.1 on a sun machine.
Best Regards,
Peter
The following is the output from running `uname -a'.
Linux localhost 2.6.12-12mdksmp #1 SMP Fri Sep 9 17:43:23 CEST 2005 i686
Intel(R) Pentium(R) 4 CPU 3.00GHz unknown GNU/Linux
The following is the output from running `g++ -v':
Using built-in specs.
Target: i586-mandriva-linux-gnu
Configured with: ../configure --prefix=/usr --libexecdir=/usr/lib
--with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info
--enable-shared --enable-threads=posix --disable-checking
--enable-languages=c,c++,ada,f95,objc,java
--host=i586-mandriva-linux-gnu --with-system-zlib --enable-long-long
--enable-__cxa_atexit --enable-clocale=gnu
--disable-libunwind-exceptions --enable-java-awt=gtk
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
--enable-gtk-cairo --disable-libjava-multilib
Thread model: posix
gcc version 4.0.1 (4.0.1-5mdk for Mandriva Linux release 2006.0)
The following is the output from running `config.guess':
pentium4-pc-linux-gnu
The following is the output from running `configfsf.guess':
i686-pc-linux-gnu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gmpbug.cpp
Type: text/x-c++src
Size: 335 bytes
Desc: not available
Url : http://gmplib.org/list-archives/gmp-bugs/attachments/20061002/e8d7f20b/attachment.bin
More information about the gmp-bugs
mailing list