tony\.reix on Wed, 05 Oct 2005 19:12:49 +0200


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

Segmentation Violation


Hi,

With the latest version of PARI/gp, I have a segmentation
violation.
Based on gdb, this seems to appear in gmp.

Tony

# gp BinomialMod.gp
GP/PARI CALCULATOR Version 2.2.10 (alpha) i686 running linux
(ix86/GMP-4.1.4 kernel) 32-bit version
compiled: Sep 26 2005, gcc-3.3.3 20040412 (Red Hat Linux
3.3.3-7) (readline v4.3 enabled, extended help available)

BinomialMod.gp loaded
33 Erreur de segmentation (core dumped)


# gdb gp core.15456
#0  mpn_fft_fft (Ap=0xfe383f30, Bp=0xfe381f30, K=1024,
ll=0xfe38a674, omega=28, n=448, inc=2, tp=0xfe385f30)
    at mul_fft.c:281
281           mpn_fft_fft (Ap, Bp, K/2,ll-1,2 * omega,n,inc2, tp);

[) bt
#0  mpn_fft_fft (Ap=0xfe383f30, Bp=0xfe381f30, K=1024,
ll=0xfe38a674, omega=28, n=448, inc=2, tp=0xfe385f30)
    at mul_fft.c:281
#1  0x0012b031 in mpn_fft_fft (Ap=0xfe383f30, Bp=0xfe381f30,
K=1024, ll=0xfe38a674, omega=14, n=448, inc=1,
    tp=0xfe385f30) at mul_fft.c:281
#2  0x0012c5ef in mpn_mul_fft_internal (op=0xd8db0008,
n=0xfe381f30, m=0xf5b507b4, pl=413696, k=11, K=2048,
    Ap=0xfe383f30, Bp=0xfe381f30, A=0xd86ab008, B=0xd8a2d008,
nprime=448, l=202, Mp=7, _fft_l=0xfe38a650,
    T=0xfe385f30, rec=0) at mul_fft.c:553
#3  0x0012ca6c in __gmpn_mul_fft (op=0xfe380f40, pl=413696,
n=0xf5ce4494, nl=-206949, m=0xf5b507b4, ml=-206949,
    k=11) at mul_fft.c:709
#4  0x0012cbc5 in __gmpn_mul_fft_full (op=0xfe380f40,
n=0xf5c1a494, nl=206747, m=0xf5a867b4, ml=206747)
    at mul_fft.c:736
#5  0x0012ebd3 in __gmpn_mul_n (p=0xfe38acc4, a=0xf5c1a494,
b=0xf5a867b4, n=206747) at mul_n.c:1167
#6  0x0012a5fd in __gmpn_mul (prodp=0xfe5e8860, up=0xf5c1a494,
un=1676179, vp=0xf5a867b4, vn=206747)
    at mul.c:146
#7  0x001330ef in __gmpn_tdiv_qr (qp=0xf5a867b4,
rp=0xf528dc84, qxn=0, np=0xf6349158, nn=-28186124,
    dp=0xf5b50628, dn=2089674) at tdiv_qr.c:382
#8  0x00815656 in dvmdii () from
/usr/local/lib/libpari-gmp-2.2.so.10
#9  0x00230a64 in strptime_l () from /lib/tls/libc.so.6


BinomialMod.gp  :
----------------------------------------
binomialmod(a,b,p)=
{
        local(B,a_,b_);
        B=1;
        while(a!=0 && b!=0,
                a_ = a%p;
                b_ = b%p;
                a  = (a-a_)/p;
                b  = (b-b_)/p;
                B  = (B*(binomial(a_,b_)))%p
             );
        return(B)
}

tb(a,p)=
{       for(i=0,a,
                print1(i);
                for(j=0,i,
                        print1(" ", binomialmod(i,j,p))
                );
        print)
}


chthp(b)=
{       local(p,i,pl);
        pl=100000000;
        default(primelimit,pl);
        i=0;
        forprime(p=b,pl,
                i++; if(i%1000==0, print1(i/1000, " "));
                if( binomialmod(2*p-1,p-1,p^3) != 1 ,
print(">>> ", p))
        );
}

chthc_old(b)=
{       local(m, n, i, l);
        l=100000000;
        i=0;
        if( (b%2)==0, b=b/2, b=(b-1)/2 );
        for(m=b,l,
                n=2*m+1;
                if(n%1000==1, print1((n-1)/1000, " "));
                if(isprime(n)==0,
                        b = binomialmod(2*n-1, n-1, n^3) ;
                        if( b == 1 , print(">>> ", n))
                );
        );
}

allocatemem(500000000)

chthc(beg, end)=
{       local(m, n, i, e, B);
        i=0;
        if( (beg%2)==0, beg=beg/2, beg=(beg-1)/2 );
        for(m=beg, end,
                n=2*m+1;
                if(n%100000==1, print1((n-1)/100000, " "));
                if(isprime(n)==0,
                        F=factor(n);
			e=1;
                        for(j=1, matsize(F)[1],
                                p=F[j,1];
                                B=binomialmod(2*n-1, n-1, p);
                                if( B != 1 , e=0; break)
                        );
                        if(e==1,
                                B=binomialmod(2*n-1, n-1, n^3);
                                if(B == 1, print(">>> ", n));
			);
                );
        );
}


bm(a,b,p)=
{
        local(B,a_,b_);
        B=1;
        while(a!=0 && b!=0,
                a_ = a%p;
                b_ = b%p;
                a  = (a-a_)/p;
                b  = (b-b_)/p;
print("a=",a," b=",b,"  a_=", a_," b_=",b_,"
binomial(a_,b_)=",binomial(a_,b_));
                B  = (B*(binomial(a_,b_)))%p
             );
        return(B)
}

print("");
print("BinomialMod.gp loaded");


chthc(3300000,10000000000);


Accédez au courrier électronique de La Poste : www.laposte.net ; 
3615 LAPOSTENET (0,34?/mn) ; tél : 08 92 68 13 50 (0,34?/mn)