Karim Belabas on Fri, 26 Jun 2009 22:54:24 +0200


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

Re: Pari svn on MSVC


* Jason Moxham [2009-06-26 21:13]:
> I'm trying to get Pari svn running under MSVC 32bit , we allready have  
> Pari-2.4.2-alpha running under MSVC 32bit with/without MPIR/GMP.
>
> The file
> /src/kernel/none/mp.c
> has minor buglet which stops compilation on MSVC
> this diff corrects the problem
>
>
> $ diff -u  ../pari/src/kernel/none/mp.c mp.c
> --- ../pari/src/kernel/none/mp.c        2009-06-26 20:02:43.788784600 +0100
> +++ mp.c        2009-06-26 17:26:16.037784600 +0100
> @@ -1480,10 +1480,13 @@
>     GEN  u = gel(V,i);
>     if (signe(u))
>     {
> +      GEN ap;
> +      GEN up;
> +      long lu;
>       LOCAL_OVERFLOW;
> -      GEN ap = int_W(a,s);
> -      GEN up = int_LSW(u);
> -      long lu = lgefint(u)-2;
> +      ap = int_W(a,s);
> +      up = int_LSW(u);
> +      lu = lgefint(u)-2;
>       *ap-- = addll(*ap, *up--);
>       for (j=1; j<lu; j++)
>         *ap-- = addllx(*ap, *up--);
>
> MSVC doesn't like it when LOCAL_OVERFLOW is empty , as the declarations 
> are not at the beginning of the block.

Indeed, thanks for reporting this !

The following "simpler" patch should also fix the problem:

Index: src/kernel/none/mp.c
===================================================================
--- src/kernel/none/mp.c        (revision 11786)                   
+++ src/kernel/none/mp.c        (working copy)                     
@@ -1480,10 +1480,10 @@                                            
     GEN  u = gel(V,i);                                            
     if (signe(u))                                                 
     {                                                             
-      LOCAL_OVERFLOW;                                             
       GEN ap = int_W(a,s);                                        
       GEN up = int_LSW(u);                                        
       long lu = lgefint(u)-2;                                     
+      LOCAL_OVERFLOW;
       *ap-- = addll(*ap, *up--);
       for (j=1; j<lu; j++)
         *ap-- = addllx(*ap, *up--);


Cheers,

    K.B.
--
Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite Bordeaux 1          Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation    http://www.math.u-bordeaux.fr/~belabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux.fr/  [PARI/GP]
`