integer overflow yields incorrect results and buffer overflow on 64-bit machines

Torbjorn Granlund tg at
Mon Feb 25 20:01:22 CET 2008

This is a known behaviour, GMP does not define any exception
processing.  Reporting it as a bug, in particular to Debian, is
utterly pointless, and I am sure you are fully aware of that.

One might say that the slogan "Arithmetic without limtations" no
longer holds, since some big tin 64-bit machines could perhaps have
enough memory to make this GMP limitation reachable.  But we're
talking of more than 128 Gibyte memory here.

Unfortunately, changing the _mp_size and _mp_alloc fields to long
cannot be done without breaking compatibility (the size of the type
should not change).

I am pondering some hairy solutions for GMP 5, stealing bits from the
_mp_alloc field for use in the _mp_size field, and letting the
remaining _mp_alloc bits be coded as a little home-brew floating point


More information about the gmp-bugs mailing list