critical bug in 4.2.2

Paul Zimmermann Paul.Zimmermann at
Mon Sep 17 17:37:34 CEST 2007


I have found a critical bug in gmp-4.2.2, which clearly requires a new
release. In the documentation, one reads:

 -- Function: mp_limb_t mpn_add_n (mp_limb_t *RP, const mp_limb_t *S1P,
          const mp_limb_t *S2P, mp_size_t N)
     Add {S1P, N} and {S2P, N}, and write the N least significant limbs
     of the result to RP.  Return carry, either 0 or 1.

     This is the lowest-level function for addition.  It is the
     preferred function for addition, since it is written in assembly
     for most CPUs.  For addition of a variable to itself (i.e., S1P
     equals S2P, use `mpn_lshift' with a count of 1 for optimal speed.

Clearly a closing parenthesis ')' is missing in the last line.

I'm puzzled this bug was not fixed before. Maybe this is a new 4.2.2 routine?

Paul Zimmermann

More information about the gmp-bugs mailing list