Bill Allombert on Mon, 1 Nov 1999 21:01:04 +0100 (MET)


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

Re: global() bug


Here a patch for the two following bugs:

? trace([;])
  ***   bus error: bug in GP (please report).

? "ee"/"aa"
  ***   bus error: bug in GP (please report).

But there still so much ...

? "ee"/x
%1 = "ee"/x
? "aa"/x
  ***   segmentation fault: bug in GP (please report).

I have a nice program than creates random GEN.
It has found its third bug:
? (5+3*I)+O(5^-18)
 ***   segmentation fault: bug in GP (please report).

So much bugs and so little time...

(CVS version updated)
Index: src/basemath/alglin2.c
===================================================================
RCS file: /home/megrez/cvsroot/pari/src/basemath/alglin2.c,v
retrieving revision 1.5
diff -u -r1.5 alglin2.c
--- src/basemath/alglin2.c      1999/10/29 09:04:51     1.5
+++ src/basemath/alglin2.c      1999/11/01 19:51:52
@@ -544,6 +544,7 @@

     case t_MAT:
       lx=lg(x); if (lx!=lg(x[1])) err(mattype1,"gtrace");
+      if (lx==1) return gzero;/*now lx>=2*/
       l=avma; p1=gcoeff(x,1,1); if (lx==2) return gcopy(p1);
       for (i=2; i<lx-1; i++)
        p1=gadd(p1,gcoeff(x,i,i));
Index: src/basemath/gen1.c
===================================================================
RCS file: /home/megrez/cvsroot/pari/src/basemath/gen1.c,v
retrieving revision 1.5
diff -u -r1.5 gen1.c
--- src/basemath/gen1.c 1999/10/30 18:12:54     1.5
+++ src/basemath/gen1.c 1999/11/01 19:51:54
@@ -2003,7 +2003,12 @@
       if (ty!=t_MAT || ly==1 || lg(y[1])!=ly) err(gdiveri,tx,ty);
       l=avma; p1=invmat(y); tetpil=avma;
       return gerepile(l,tetpil,gmul(x,p1));
+     case t_QFI:case t_QFR:
+       break;
+     default:
+       err(typeer,"division");
   }
+  /*Here tx==t_QFI || tx==t_QFR*/
   if (tx==ty)
   {
     l=signe(y[2]); setsigne(y[2],-l);