Likely GMP bug

Marco Bodrato bodrato at
Mon May 28 05:03:00 UTC 2018


Il Sab, 26 Maggio 2018 11:01 pm, Niels Möller ha scritto:
> Is it possible to construct some examples with v a multiple of 641, and
> input U such that ulimb = 2^31 after reduction?

It was hard, but we got it:

The bug is triggered not only for 32-bit limbs, but also for other sizes.
On any machine, if the undefined behaviour is not the one we hope,

./configure --disable-assembly && make
make check TESTS= && tests/mpz/t-gcd_ui

should fail.
It does, with ABI=64 on shell.

Of course I also healed the bug, to avoid too many red lines in the next
"GMP testing status": .
This is just a workaround, waiting for a code reorganisation by someone
who knows better than me the various algorithm alternatives.



More information about the gmp-bugs mailing list