Bill Allombert on Tue, 4 Mar 2003 16:14:33 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: znstar() bug (gmp kernel)


On Mon, Mar 03, 2003 at 01:57:18AM -0500, Igor Schein wrote:
> Hi,
> 
> 
>           GP/PARI CALCULATOR Version 2.2.6 (development CHANGES-1.685)
>       i686 running linux (ix86/GMP-4.1 kernel) 32-bit version -- debugging
>                 (readline v4.3 enabled, extended help available)
> 
> ? znstar(35962368471727496841722887);
>   ***   impossible assignment I-->S
> 
> I coudn't reproduce it without gmp or on Solaris.

Well spotted! You found the only line in Gerhart code that assume
that integers are MSW!

Here the patch (commited to CVS).

Index: src/basemath/ifactor1.c
===================================================================
RCS file: /home/megrez/cvsroot/pari/src/basemath/ifactor1.c,v
retrieving revision 1.46
diff -u -r1.46 ifactor1.c
--- src/basemath/ifactor1.c     2003/02/08 18:03:35     1.46
+++ src/basemath/ifactor1.c     2003/03/04 15:05:55
@@ -2087,10 +2087,10 @@
   if (cmpis(n,5) <= 0) return NULL; /* input n <= 5 */

 #ifdef LONG_IS_64BIT
-  if (tf > 3 || (tf == 3 && bfffo((ulong)n[2]) < 5)) /* n too large */
+  if (tf > 3 || (tf == 3 && bfffo(int_MSW(n)) < 5)) /* n too large */
     return NULL;
 #else  /* 32 bits */
-  if (tf > 4 || (tf == 4 && bfffo((ulong)n[2]) < 5)) /* n too large */
+  if (tf > 4 || (tf == 4 && bfffo(int_MSW(n)) < 5)) /* n too large */
     return NULL;
 #endif
   /* now we have 5 < n < 2^59 */

Cheers,
Bill