Bug#951004: libmath-prime-util-gmp-perl: Patch for FTBFS with gmp 6.2.0: test failure

Marco Bodrato bodrato at mail.dm.unipi.it
Tue Feb 18 15:19:05 GMT 2020


Ciao,

Il 2020-02-18 12:39 Marco Bodrato ha scritto:
> A proposed patch:

Looking at it twice, it is probably better to propose a cleaner patch, 
that can be adopted also upstream:

*** squfof126.c~	2020-02-18 15:03:43.371325091 +0100
--- squfof126.c	2020-02-18 15:25:46.208271285 +0100
***************
*** 43,57 ****
     return v;
   }
   static INLINE void mpz_set64(mpz_t n, SQUFOF_TYPE v) {
!   if (v == 0) {
!     mpz_set_ui(n,0);
!   } else if (GMP_LIMB_BITS < 64 || sizeof(mp_limb_t) < 
sizeof(SQUFOF_TYPE)) {
       mpz_set_ui(n, (uint32_t)(v >> 32));
       mpz_mul_2exp(n, n, 32);
       mpz_add_ui(n, n, (uint32_t)v);
     } else {
!     n->_mp_d[0] = v;
!     n->_mp_size = 1;
     }
   }

--- 43,54 ----
     return v;
   }
   static INLINE void mpz_set64(mpz_t n, SQUFOF_TYPE v) {
!   if (v > ULONG_MAX) {
       mpz_set_ui(n, (uint32_t)(v >> 32));
       mpz_mul_2exp(n, n, 32);
       mpz_add_ui(n, n, (uint32_t)v);
     } else {
!     mpz_set_ui(n, v);
     }
   }


Because set_ui requires an unsigned long parameter. The set_ui, 
mul_2exp, add_ui trick is needed if sizeof(unsigned long) < 
sizeof(SQUFOF_TYPE), but for large values only.

Ĝis,
m

-- 
http://bodrato.it/papers/



More information about the pkg-perl-maintainers mailing list