Likely GMP bug
Torbjörn Granlund
tg at gmplib.org
Mon May 28 09:34:01 UTC 2018
"Marco Bodrato" <bodrato at mail.dm.unipi.it> writes:
It was hard, but we got it:
https://gmplib.org/repo/gmp/rev/1f8a8fefb5c2
Thanks!
It really worries me that our crazy broad testing did not catch this
until now. This makes me much less confident about GMP's correctness,
actually.
I realise that a plain assembly enabled build will not trigger this for
any current platform, so few people will be afffected in practice.
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": https://gmplib.org/repo/gmp/rev/e4849ae7c974 .
This is just a workaround, waiting for a code reorganisation by someone
who knows better than me the various algorithm alternatives.
Replacement code should not jump into loops. This bug (but not the
shortcoming of the test suite) should teach us that lesson.
--
Torbjörn
Please encrypt, key id 0xC8601622
More information about the gmp-bugs
mailing list