Undefined-behavior overflows in GMP?

Torbjorn Granlund tg at gmplib.org
Tue Nov 20 21:03:50 CET 2012

Vincent Lefevre <vincent at vinc17.net> writes:

  Concerning the mul_i.h problem, it was fixed there, AFAIK:
  2012-02-09  Marc Glisse  <marc.glisse at inria.fr>
          * gmp-impl.h (ABS_CAST): New macro.
          * mpf/cmp_si.c: Use ABS_CAST.
          * mpf/get_si.c: Use ABS_CAST.
          * mpf/iset_si.c: Use ABS_CAST.
          * mpf/set_si.c: Use ABS_CAST.
          * mpq/set_si.c: Use ABS_CAST.
          * mpz/cmp_si.c: Use ABS_CAST.
          * mpz/get_si.c: Use ABS_CAST.
          * mpz/iset_si.c: Use ABS_CAST.
          * mpz/mul_i.h: Use ABS_CAST.
          * mpz/set_si.c: Use ABS_CAST.

I see, now I understand why I didn't find the purported problems: I
guessed the wrong directory (missing from the original report) and there
was an off-by-one error.

(Curiously enough, mpz/cmp_si.c does not use ABS_CAST.)


More information about the gmp-devel mailing list