New GMP release

Torbjorn Granlund tg at
Fri Feb 10 14:03:15 CET 2012

A new release of the GNU Multiple Precision Arithmetic Library (GMP)
is now available.  The new release is identified as 5.0.4.

The new release can be downloaded from the main GNU ftp site:
  xz format:
  bzip2 format:

These files can also be found from the main GMP domain, e.g.

The changes between this release and the previous release are limited
to various safe bug fixes and portability improvements.

GMP 5.0 is the currently maintained stable release series; we
recommend everyone to switch from earlier GMP releases to GMP 5.0.4.

We make this release just two weeks after the last release since we have
found several bugs, one being a regression.  See below for details, or
the STATUS section of

While GMP bugs do happen, the absolutely most common cause for
incorrect computations with GMP is bugs in the compiler used for
building he library.  It cannot be said enough times: Please run "make
check" after you've built GMP.  And if "make check" stops with an
error, do not use the compiled library.  When this happens, you've
almost surely run into a compiler bug, not a library bug, since we've
of course made sure the library passes its own test suite.  The first
thing to try at this point is using a different compiler.  See also  GCC version 4.3.2 is known to miscompile this GMP
release on all 64-bit platforms; this manifests itself at a check
failure in tests/mpz/t-root.c.

The GMP 5.0 release series would not have been possible without the
very devoted work of Niels Möller and Marco Bodrato.  Torbjörn
Granlund coordinated the development and release, and did a fair
amount of development work himself.  Marc Glisse helped with the C++

Changes between GMP version 5.0.3 and 5.0.4

  * Thresholds in mpn_powm_sec for both fat and non-fat builds are now used
    safely, plugging a one-word buffer overrun introduced in the 5.0.3 release
    (for non-fat) and a multi-word buffer overrun that existed since 5.0 (for
    fat).  (We have not been able to provoke malign stack smashing in any of
    the ~100 configurations explored by the GMP nightly builds, but the bug
    should be assumed to be exploitable.)

  * Two bugs in multiplication code causing incorrect computation with
    extremely low probability have been fixed.

  * Two bugs in the gcd code have been fixed.  They could lead to incorrect
    results, but for uniformly distributed random operands, the likelihood for
    that is infinitesimally small.  (There was also a third bug, but that was
    an incorrect ASSERT, which furthermore was not enabled by default.)

  * A bug affecting 32-bit PowerPC division has been fixed.  The bug caused
    miscomputation for certain divisors in the range 2^32 ... 2^64-1 (about 1
    in 2^30 of these).

  * None, except indirectly through recognition of new CPUs, and through better
    tuning parameters.

  * Some more tests added to the self-check suite.

  * The AMD "Bulldozer" CPU is now recognised.

  * None.

There is a public repository for GMP, please see the GMP web site at for more information.

Torbjörn's work on GMP is sponsored by "Stiftelsen för Strategisk
Forskning", through CIAM at KTH,


More information about the gmp-announce mailing list