Patches and status for old GMP releases |
N.B. Patches linked herein do not all carry a copyright header. This does not mean that we do not claim copyright, nor does it mean that we intend it to default to the "All rights reserved" status. The patches herein are under the LGPL 3.0 or later, see https://www.gnu.org/licenses/.
Issues with GMP 5.0.5:
Issues with GMP 5.0.4:
make
check.
These 11h processors are intermediates between K8 and K10,
of sorts, in spite of that they have higher 'family' number than K10.
Issues with GMP 5.0.3:
Issues with GMP 5.0.2:
Issues with GMP 5.0.1:
make check
failures. The problem is in
mpn/pa64/aors_n.asm. Please download a new version of the
file from the GMP repository. Issues with GMP 5.0.0 (see also info about 5.0.1 above):
make check
failures with t-constants. (3)
There are issues with getting the compiler in 64-bit mode for some
versions of Xcode. (The GMP developers don't have any x86 Mac for
development or testing. Since every OS version is incompatible with every
other OS version, and every Xcode version has its own requirements and
quirks, one would probably need a whole array of Mac OS systems to maintain
GMP well for this platform!)
Issues with GMP 4.3.2:
Issues with GMP 4.3.1 (see also info about 4.3.2 above):
Issues with GMP 4.3.0 (see also info about 4.3.1 above):
Issues with GMP 4.2.4:
mpz_perfect_power_p
does not work
correctly for negative arguments, but rejects many negative perfect powers.
Patch
mpf_set_str
(perhaps indirectly
via mpf_init_set_str
or mpf_inp_str
, or via the
C++ interface) with the argument for the base set to 0, any exponent will
be ignored. Patch
mpf_eq
function sometimes compares too few
bits, not just too many (the latter is documented). This might lead to
precision loss. When the experimental --enable-nails feature is enabled
at the same time --enable-cxx is enabled, make check
fails.
This failure is actually due to bugs in tests/cxx/t-prec.cc
,
which makes it use mpf_eq
incorrectly. This patch makes
mpf_eq
compare the right number of bits, neither too few, nor
to many. The patch also fixes the test case, and updates the
documentation. Patch
Additional issues with GMP 4.2.3:
mpf_set_str
,
mpf_init_set_str
, or mpf_inp_str
a number with a
mantissa of larger precision than the destination variable, a buffer
overrun may occur. The overrun can be arbitrarily large. The problem is
a completely incorrect allocation in mpf_set_str
(in the
file mpf/set_str.c
), where the destination variable's precision
was used for an allocation that needed a size proportional to the string
size. Patch
Additional issues with GMP 4.2.2:
mpf_set_str
,
mpf_init_set_str
, or mpf_inp_str
with a
base > 36, the supplied base will actually be ignored, and
the exponent 0 will be supplanted.
Patch
Additional issues with GMP 4.2.1:
mpz_set_d
, arguments smaller than 1e-19 will trigger
undefined behaviour, typically a crash. Note that this is a somewhat
degenerate use of mpz_set_d
that should not normally happen, since any
arguments < 1 will yield 0. Patch
mpz_popcount
, mpz_hamdist
, and
mpn_popcount
will work unreliably when GMP is compiled with
certain compilers. The symptom is segmentation fault. This is due to a
GMP bug. Patch
mpn/generic/addsub_n.c
. Second, GMP's build system
passes options such as -march=athlon or -march=pentium4, and this can of
course result in surprises for older processors.
Patch [Updated 2006-06-12 to apply more
smoothly]
Additional issues with GMP 4.2:
mpf
output conversion
yielding more than 2^31-1 digits will return only part of the digits.
There are other problems with these routines when using the experimental
nails feature. Patch
mpn_rootrem
, affecting the user-level functions
mpz_root
, mpz_rootrem
and
mpz_perfect_power_p
. The potential overrun is a function of
input operand size, i.e., with large operands the overrun can be large.
Patch
mpz_sizeinbase
returns
garbage for operands greater than or equal to 2^31. The error is in
gmp-impl.h
, which you need to patch. (Please note
that operands of this size might trigger other problems in GMP; we will
address this thoroughly for GMP 5.)
ABI=o32
mode
using the native SGI tools, the GMP configure
test for an
assembler underscore prefix fails. Pass
gmp_cv_asm_underscore=no
to configure
as a
workaround.
mpf_sub
has two problems. When the result is zero the
exponent may not be zeroed, causing incorrect operation in subsequent
operations such as mpf_cmp_ui
and mpz_set_f
.
When high limbs cancel out, zeros at the top of the remainder are
incorrectly counted towards the destination precision, causing a loss of
accuracy and in particular possibly leading to a zero result when the
operands are not equal. Patch for
mpf/sub.c.
k6*-*-*
), a bug in the assembler code may
cause wrong results from mpz_gcd
and other functions using
GCDs. Patch for
mpn/x86/k6/gcd_finda.asm.
--enable-profiling
, certain mpz
routines may give incorrect results due to gcc (version 3.3 for instance)
not realizing that the profiler calls may clobber regparm
registers. If profiling is desired then change gmp-impl.h to force
USE_LEADING_REGPARM
to 0
.
defined (PPC)
from the two #if
's in that file.
powerpc*-apple-darwin7.2.0
, a bug in the C library
sscanf
affects certain EOF returns from
gmp_sscanf
, causing a failure in GMP tests/misc/t-scanf.c
(line 1421). Hopefully Apple will fix this before too long. Past
versions of Darwin have been ok.
__GMP_DECLSPEC
to mpn_copyi
,
mpn_copyd
and __gmp_fib_table
in gmp-impl.h.
substr()
strings as arguments, due to lack of scalar magic
handling in GMP.xs. For now the suggestion is to ignore the test.pl
failures and to avoid passing substrings directly to the GMP module.
cc
, the default
flags don't include -xarch=v8plus
needed for the GMP
assembler code. Configure with ./configure CFLAGS="-xtarget=native
-xarch=v8plus -xO4"
mpfr_class
from
mpf_class
.
Patch.
count_trailing_zeros
in
longlong.h may cause errors from the assembler about incorrect registers
used with bsfq
.
Patch.
make CC=g++
" (in GMP.xs
class_or_croak
, rename the class
variable since
that's a keyword in C++).
/
and %
operators on
mpz_class
and long
operand combinations may
give incorrect results. Patch
(applications must be recompiled).
FE_TOWARDZERO
).
Removing the offending cases will allow the library to build, though
several test programs will fail.
double
format is not identified by
gmp-impl.h, which can cause an MPFR build to fail.
Patch.
mpz_gcd_ui
may return a bad value
when v==0 and u fits a limb but not a ulong.
Patch.
double
constants
being compiled incorrectly. This can cause an MPFR build to fail.
Patch.
mpz_addmul
and mpz_submul
on Solaris 8 using a
shared libgmp.so built by gcc 2.96 or higher may give incorrect results
due to regparm
registers being clobbered by lazy binding.
This might arise on other i386 systems too, though a GNU system with
GLIBC 2.1 or higher is known to be safe.
Patch.
alphaev67
and alphaev68
, longlong.h uses GCC
style __asm__
blocks without checking that GCC is being used.
Patch.
--host=none-hp-hpux11
(check ./config.guess
for
the exact OS type). Also double
floats are not correctly
treated as big-endian; in gmp-impl.h move the __ia64
test for
ieee_double_extract
down to the big-endian case. Also, the
unbundled HP compilers coredump when compiling mpn/generic/mul_fft.c at
high optimization levels; step into the mpn build directory and type
"make CFLAGS=+O1 mul_fft.lo".
CC=gcc-with-my-options
.
ABI=32
build gets
incorrect setups, resulting in asm files failing to build. In the
generated config.m4
change
include_mpn(`powerpc64/aix.m4')
to
include_mpn(`powerpc32/aix.m4')
--disable-shared
when using --enable-cxx
on
that system.
define(_GLOBAL_OFFSET_TABLE_,__GLOBAL_OFFSET_TABLE_)
configure
add gcc_64_ldflags="-Wc,-m64"
just
after the v9 gcc_64_cflags
, or alternately override at make
time with make GMP_LDFLAGS="-Wc,-m64"
.
alphaev67
and alphaev68
a shared library may
fail to build due to __gmpn_clz_tab
. Remove the
#ifdef
from mp_clz_tab.c.
tests/mpz/t-sizeinbase.c
has been seen failing on HPPA
systems, due to some rash assumptions made about pointer arithmetic in
that program. This can be ignored.
SCANF_OBJECTS
not defined. This is due to the trailing
backslash on the end of the preceding PRINTF_OBJECTS
.
Remove that from the generated Makefile
.
mpf_inp_str
returns an incorrect character count for valid
input, and leaks memory for invalid input.
Patch. (This problem has been present
since 2.0.)
mpz_class::get_num
and get_den
return a special
type which behaves like mpz_class&
but is not identical.
An actual mpz_class&
can be obtained with this
patch.
mpz_powm_ui
may return a result outside the range 0 to m-1
in certain circumstances (e==1, abs(b)>m, m normalized). Patch. (This problem was present also in 4.0.)
.register
directives
in mpn/sparc64/*.asm. Delete those lines if necessary.
alphaev56
incorrectly selects just the ev4 code.
Configure as alphaev5
for a speedup.
./configure
doesn't recognise the version number format used
by GCC 3.1 on MINGW and Solaris, which can mean
-march=pentiumpro
is omitted unnecessarily. Patch.
t-scanf
fails on x86_64 systems, due to some
sloppy varargs handling in that program. The library code as such is
believed to be ok.
cmp
functions described in the manual are in gmpxx.h
as compare
. The line
__GMP_DEFINE_BINARY_TYPE_FUNCTION(int, compare,
__gmp_cmp_function)
can be edited to make it match the manual.
gmp_printf
and friends have a bug affecting %s
and %p
. In printf/doprnt.c under case 'p': case
's':
, the break
should be goto next
.
gmp_printf
and friends are supposed to accept
%zd
etc for size_t
output, but in
printf/doprnt.c need a line case 'z':
added above the
set_type:
label.
gmp_printf
, gmp_scanf
, and friends, incorrectly
claim size_t
is unavailable when given %zn
. In
printf/doprnt.c and scanf/doscan.c remove the #if
HAVE_SIZE_T
conditionals, leaving just the code for the "true"
case.
intmax_t
is in
<inttypes.h>
. Change printf/doprnt.c,
printf/repl-vsnprintf.c and scanf/doscan.c to use
#if HAVE_INTTYPES_H # include <inttypes.h> #else # if HAVE_STDINT_H # include <stdint.h> # endif #endif
libgmp.la:
$(libgmp_la_OBJECTS) $(libgmp_la_DEPENDENCIES)
, apparently due to
the length of the dependencies list. Either use GNU Make, or as a
workaround remove $(libgmp_la_DEPENDENCIES)
from that line
(which will make the initial build work, but if any recompiling is done
libgmp.la might not be rebuilt at the right time).
gcc -march=pentiumpro
or
-march=athlon
doesn't know to use the zany cmov
syntax required by the native assembler. This can affect GMP. The suggestion
is either to use GNU binutils, or configure GMP with that flag downgraded to
-march=pentium
, for example on a P-Pro, P-II or P-III
./configure CFLAGS="-g -O2 -fomit-frame-pointer -mcpu=pentiumpro
-march=pentium"
.
ABI=64
by default, but this
will fail if the kernel is in 32-bit mode. Use ./configure
ABI=32
instead (in the future GMP will fall back to that
automatically). But note that ABI=64
will give better
performance, so consider rebooting into 64-bit mode (with ok boot
kernel/sparcv9/unix
).
#include <strstream.h>
uncommented.
Either that or delete the unused get_str2
function which depends
on it.
configure
may not automatically detect the correct CPU
under cygwin and may guess i686 which is not a valid CPU. The suggested
workaround is "./configure --host=pentiumpro-pc-cygwin32"
(with
whatever CPU is approriate in place of pentiumpro). mpq_equal
makes it fail if the first compared operand
is negative. This patch corrects the problem.
Joe Keane found the problem and wrote the patch.
mpf_set_str
and mpf_get_str
make
these functions segfault, and possibly generate incorrect results. This also
affects mpf_out_str
, mpf_inp_str
, and
mpf_init_set_str
. This gzip'ed patch fixes these errors.
mpz_invert
makes it sometimes return a negative
result, and sometimes not detect when an inverse does not exist. Apply this
patch to mpz/invert.c to fix this.
mpq_add
and mpq_sub
makes them work
unreliably due to references outside of allocated memory. Apply this patch to the mpq subdirectory to fix this.
CFLAGS="-g -O2 -mcpu=power"
or
CFLAGS="-g -O2 -mcpu=powerpc"
to `make' to work around this.
(Choose the form that is appropriate for your system; if you're unsure which
processor type you have, try running config.guess from the GMP top level
directory.)
mpz_probab_prime_p
makes it work unreliably for
numbers < 4. Apply this patch to
mpz/pprime_p.c to fix the bug.
mpf_set_q
makes it get the sign wrong for
negative numbers, and write to unallocated memory for other numbers. Apply
this patch to mpf/set_q.c to fix the bugs.
mpn_divrem
makes it occationally
write outside of the numerator/remainder operand. Even if this function is
called by several other GMP functions, only mpf_get_str
,
mpf_set_q
, and mpf_set_str
call it in a way that
risk to trigger the bug. Apply this patch to
mpn/generic/divrem.c to fix the bug.
Some GNU/Linux distributions have a buggy ar program that omits many of the files from libgmp.a. As a result libgmp.a becomes useless. The best solution is to get a newer GNU release of binutils, version 2.6 or later. As a workaround, you could also apply this patch to the top-level directory of GMP 2.0.2, if you don't want to upgrade your GNU/Linux tools. The patch was written by Alexander Zimmermann.