#19649: Crash in pari polroots()
-------------------------------------------------+-------------------------
       Reporter:  kedlaya                        |        Owner:
           Type:  defect                         |       Status:  new
       Priority:  major                          |    Milestone:  sage-6.10
      Component:  interfaces                     |   Resolution:
       Keywords:  pari, polynomials, roots       |    Merged in:
        Authors:  Jeroen Demeyer                 |    Reviewers:
Report Upstream:  Fixed upstream, but not in a   |  Work issues:
  stable release.                                |       Commit:
         Branch:                                 |     Stopgaps:
   Dependencies:                                 |
-------------------------------------------------+-------------------------

Old description:

> We've seen weird issues with pari.polroots before (e.g., #2418); this may
> be related. (Observed in Sage 6.9, on multiple platforms.)
> {{{
> sage: polRing.<x> = PolynomialRing(ZZ)
> sage: j = (x+1)^2 * (x-1)^7 * (x^2-x+1)^5
> sage: l = j.roots(CC)
> ---------------------------------------------------------------------------
> SignalError                               Traceback (most recent call
> last)
> <ipython-input-106-2450a50ef70a> in <module>()
> ----> 1 l = j.roots(CC)
>
> /home/kedlaya/sage-
> complete/src/sage/rings/polynomial/polynomial_element.pyx in
> sage.rings.polynomial.polynomial_element.Polynomial.roots
> (/home/kedlaya/Downloads/sage-6.9/src/build/cythonized/sage/rings/polynomial/polynomial_element.c:53329)()
>    6344                     real_field = RealField(L.prec())
>    6345
> -> 6346                 return self.change_ring(real_field).roots(ring=L,
> multiplicities=multiplicities, algorithm=algorithm)
>    6347             elif is_pAdicRing(L) or is_pAdicField(L):
>    6348                 p = L.prime()
>
> /home/kedlaya/sage-
> complete/src/sage/rings/polynomial/polynomial_element.pyx in
> sage.rings.polynomial.polynomial_element.Polynomial.roots
> (/home/kedlaya/Downloads/sage-6.9/src/build/cythonized/sage/rings/polynomial/polynomial_element.c:50813)()
>    6251                 if not input_arbprec:
>    6252                     self = self.change_ring(CC if input_complex
> else RR)
> -> 6253                 ext_rts = pari(self.monic()).polroots(precision =
> L.prec())
>    6254
>    6255             if output_complex:
>
> /home/kedlaya/sage-complete/src/sage/libs/pari/gen.pyx in
> sage.libs.pari.gen.gen.polroots
> (/home/kedlaya/Downloads/sage-6.9/src/build/cythonized/sage/libs/pari/gen.c:133557)()
>    8236             from sage.misc.superseded import deprecation
>    8237             deprecation(16997, 'The flag argument to polroots()
> is deprecated and not used anymore')
> -> 8238         pari_catch_sig_on()
>    8239         return P.new_gen(cleanroots(self.g,
> prec_bits_to_words(precision)))
>    8240
>
> /home/kedlaya/sage-complete/src/sage/ext/interrupt/interrupt.pyx in
> sage.ext.interrupt.interrupt.sig_raise_exception
> (/home/kedlaya/Downloads/sage-6.9/src/build/cythonized/sage/ext/interrupt/interrupt.c:1356)()
>     108         if msg == NULL:
>     109             msg = "Segmentation fault"
> --> 110         raise SignalError(msg)
>     111
>     112     raise SystemError("unknown signal number %s"%sig)
>
> SignalError: Segmentation fault
> }}}
>
> Equivalent GP session:
> {{{
> gp> \p10
>    realprecision = 19 significant digits (10 digits displayed)
> gp> polroots((x+1)^2 * (x-1)^7 * (x^2-x+1)^5 * 1.0)
>   ***   at top-level: polroots((x+1)^2*(x-
>   ***                 ^--------------------
>   *** polroots: bug in PARI/GP (Segmentation Fault), please report.
> }}}
>
> '''Upstream bug''': [http://pari.math.u-bordeaux.fr/cgi-
> bin/bugreport.cgi?bug=1767]

New description:

 We've seen weird issues with pari.polroots before (e.g., #2418); this may
 be related. (Observed in Sage 6.9, on multiple platforms.)
 {{{
 sage: polRing.<x> = PolynomialRing(ZZ)
 sage: j = (x+1)^2 * (x-1)^7 * (x^2-x+1)^5
 sage: l = j.roots(CC)
 ---------------------------------------------------------------------------
 SignalError                               Traceback (most recent call
 last)
 <ipython-input-106-2450a50ef70a> in <module>()
 ----> 1 l = j.roots(CC)

 /home/kedlaya/sage-
 complete/src/sage/rings/polynomial/polynomial_element.pyx in
 sage.rings.polynomial.polynomial_element.Polynomial.roots
 
(/home/kedlaya/Downloads/sage-6.9/src/build/cythonized/sage/rings/polynomial/polynomial_element.c:53329)()
    6344                     real_field = RealField(L.prec())
    6345
 -> 6346                 return self.change_ring(real_field).roots(ring=L,
 multiplicities=multiplicities, algorithm=algorithm)
    6347             elif is_pAdicRing(L) or is_pAdicField(L):
    6348                 p = L.prime()

 /home/kedlaya/sage-
 complete/src/sage/rings/polynomial/polynomial_element.pyx in
 sage.rings.polynomial.polynomial_element.Polynomial.roots
 
(/home/kedlaya/Downloads/sage-6.9/src/build/cythonized/sage/rings/polynomial/polynomial_element.c:50813)()
    6251                 if not input_arbprec:
    6252                     self = self.change_ring(CC if input_complex
 else RR)
 -> 6253                 ext_rts = pari(self.monic()).polroots(precision =
 L.prec())
    6254
    6255             if output_complex:

 /home/kedlaya/sage-complete/src/sage/libs/pari/gen.pyx in
 sage.libs.pari.gen.gen.polroots
 
(/home/kedlaya/Downloads/sage-6.9/src/build/cythonized/sage/libs/pari/gen.c:133557)()
    8236             from sage.misc.superseded import deprecation
    8237             deprecation(16997, 'The flag argument to polroots() is
 deprecated and not used anymore')
 -> 8238         pari_catch_sig_on()
    8239         return P.new_gen(cleanroots(self.g,
 prec_bits_to_words(precision)))
    8240

 /home/kedlaya/sage-complete/src/sage/ext/interrupt/interrupt.pyx in
 sage.ext.interrupt.interrupt.sig_raise_exception
 
(/home/kedlaya/Downloads/sage-6.9/src/build/cythonized/sage/ext/interrupt/interrupt.c:1356)()
     108         if msg == NULL:
     109             msg = "Segmentation fault"
 --> 110         raise SignalError(msg)
     111
     112     raise SystemError("unknown signal number %s"%sig)

 SignalError: Segmentation fault
 }}}

 Equivalent GP session:
 {{{
 gp> \p10
    realprecision = 19 significant digits (10 digits displayed)
 gp> polroots((x+1)^2 * (x-1)^7 * (x^2-x+1)^5 * 1.0)
   ***   at top-level: polroots((x+1)^2*(x-
   ***                 ^--------------------
   *** polroots: bug in PARI/GP (Segmentation Fault), please report.
 }}}

 '''Upstream bug''': [http://pari.math.u-bordeaux.fr/cgi-
 bin/bugreport.cgi?bug=1767]

 '''New tarball''':
 [http://sage.ugent.be/www/jdemeyer/sage/pari-2.8-2044-g89b0f1e.tar.gz]

--

Comment (by jdemeyer):

 Replying to [comment:4 kedlaya]:
 > Karim Belabas reports that he has fixed this in the master development
 branch (see upstream link). Since there is an Atelier Pari/GP in January,
 I hope this makes it into a stable release shortly thereafter.

 In Sage, we are using the development version of PARI anyway. I'll try
 upgrading PARI to the fixed version.

--
Ticket URL: <http://trac.sagemath.org/ticket/19649#comment:5>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to