| Karim BELABAS on Tue, 28 Sep 1999 17:52:05 +0200 (MET DST) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| 2.0.17-patch 1 (was: please report, report) |
[Paul van Wamelen:]
> I just found the following in 2.0.16 (have not installed 17 yet...)
> [...]
> ? Mod(polcyclo(15),polcyclo(15))^(-1)
> *** segmentation fault: bug in GP (please report).
>
> \\ and
>
> ? Mod(x,x)^(-1)
> *** bus error: bug in GP (please report).
Two bugs in one actually [1- wrong method chosen in isinexactfield(). 2- the
SEGV proper in case of unexpected input].
Here's a patch.
Karim.
P.S for CVS users: The development CVS archive has been updated (i.e cvs
checkout will always mirror my current set of sources). To fetch the original
2.0.17.beta release, use 'cvs checkout -r 2-0-17-release'.
Index: src/basemath/polarit2.c
===================================================================
RCS file: /home/megrez/cvsroot/pari/src/basemath/polarit2.c,v
retrieving revision 1.2
diff -c -r1.2 polarit2.c
*** src/basemath/polarit2.c 1999/09/20 13:30:05 1.2
--- src/basemath/polarit2.c 1999/09/28 11:50:01
***************
*** 1412,1418 ****
case t_REAL: case t_PADIC: case t_SER:
return 1;
case t_POL:
! lx=lgef(x);
for (i=2; i<lx; i++)
if (!isinexactfield((GEN)x[i])) return 0;
return 1;
--- 1412,1418 ----
case t_REAL: case t_PADIC: case t_SER:
return 1;
case t_POL:
! lx=lgef(x); if (lx == 2) return 0;
for (i=2; i<lx; i++)
if (!isinexactfield((GEN)x[i])) return 0;
return 1;
***************
*** 1445,1450 ****
--- 1445,1451 ----
long i,dx=lgef(x)-3,dy=lgef(y)-3,lz=dx+dy, av=avma, tetpil;
GEN v,z;
+ if (dx < 0 || dy < 0) err(talker,"non-invertible polynomial in polinvmod");
z=cgetg(dy+2,t_POL); z[1]=y[1];
v=cgetg(lz+1,t_COL);
for (i=1; i<lz; i++) v[i]=zero;
***************
*** 2031,2043 ****
/* RESULTANT PAR MATRICE DE SYLVESTER */
/* */
/*******************************************************************/
GEN
sylvestermatrix_i(GEN x, GEN y)
{
long d,dx,dy,i,j;
GEN p1,p2;
! dx=lgef(x)-3; dy=lgef(y)-3; d=dx+dy;
p1=cgetg(d+1,t_MAT);
for (j=1; j<=dy; j++)
{
--- 2032,2054 ----
/* RESULTANT PAR MATRICE DE SYLVESTER */
/* */
/*******************************************************************/
+ static GEN
+ _zeropol()
+ {
+ GEN x = cgetg(3,t_POL);
+ x[1] = evallgef(3);
+ x[2] = zero; return x;
+ }
+
GEN
sylvestermatrix_i(GEN x, GEN y)
{
long d,dx,dy,i,j;
GEN p1,p2;
! dx = lgef(x)-3; if (dx < 0) { dx = 0; x = _zeropol(); }
! dy = lgef(y)-3; if (dy < 0) { dy = 0; y = _zeropol(); }
! d = dx+dy;
p1=cgetg(d+1,t_MAT);
for (j=1; j<=dy; j++)
{
__
Karim Belabas email: Karim.Belabas@math.u-psud.fr
Dep. de Mathematiques, Bat. 425
Universite Paris-Sud Tel: (00 33) 1 69 15 57 48
F-91405 Orsay (France) Fax: (00 33) 1 69 15 60 19
--
PARI/GP Home Page: http://hasse.mathematik.tu-muenchen.de/ntsw/pari/