Karim Belabas on Wed, 31 Oct 2012 11:12:46 +0100

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

Re: segfault in bnfisintnorm

* Charles Greathouse [2012-10-31 03:10]:
> > version()
> %1 = [2, 6, 0, "git-2472469"]
> > bnfisintnorm(bnfinit('y^2+93),54647)
>   ***   at top-level: bnfisintnorm(bnfinit
>   ***                 ^--------------------
>   *** bnfisintnorm: bug in PARI/GP (Segmentation Fault), please report.
>   ***   Break loop: type 'break' to go back to GP prompt

The underlying bug ( in bnfisprincipal() ) is not specific to the 'testing'
branch, but hard to reproduce in 'stable': it is in principle there, but
I couldn't trigger the problematic code paths.

Deep down, the problem is due to an old design bug which I do not know how to
fix without breaking backward compatility in a very painful way: the PARI t_MAT
type can't exactly represent matrix(n,0)  [ always treated as matrix(0,0) ],
so generic linear algebra code must be wary of maps from (or to) the
null vector space, because dimensions become 0 in an unexpected way. :-(

That specific instance of careless code is now triggered in master
because bnfinit() is able to return a result with smaller factorbases than
before, i.e. smaller matrices. So an intermediate matrix with 11 columns in
'stable' ends up with 0 columns in 'testing'.

Nice catch, thanks ! :-)


P.S: Fixed in 

commit 37e6ba38f4a5795634a863672e078e6e6b43852f
Author: Karim Belabas <Karim.Belabas@math.u-bordeaux1.fr>
Date:   Wed Oct 31 10:52:14 2012 +0100

    isprincipal: treat the case of B = [;]
    Actually, B = matrix(n, 0) but PARI can't represent that => matrix(0,0).
    Error (high-level function) or SEGV (low-level function)
    Test-case: bnfisintnorm(bnfinit('y^2+93),54647)

P.S2: It is very important to report bugs, the preferred way is through
our Bug Tracking System:


This is a little more cumbersome for the reporter than a direct email to
me, Bill, or the mailing lists. But in the long run, it saves a huge
amount of development time, because all the information is gathered in a
single place, easy to search and examine even years after a problem
has been fixed, and long since forgotten.

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-bordeaux1.fr/~belabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux1.fr/  [PARI/GP]