overflow in mpz type with a simple mpz_add_ui

Torbjörn Granlund tg at gmplib.org
Mon Sep 21 16:16:15 UTC 2020

Vincent Lefevre <vincent at vinc17.net> writes:

  So the overflow occurs in "mpz_add_ui (z, z, 1);", though this
  operation doesn't need a larger mpz_t and could even be done
  in place: no carry occurs here, and note that a carry for a
  huge number is very unlikely to occur.

No bug.  You're (presumably deliberately) dancing on the edge of mpz
overflow.  The overflow detection flags some false positives, which is
by design.

Please encrypt, key id 0xC8601622

More information about the gmp-bugs mailing list