Hello mpir-devel,

I think I found a bug in MPIR 2.1.1 in mpz_divexact() (or I'm doing
something something very stupid).  Running the following program gives a
Segmentation Fault:

#include <mpir.h>
int main()
{
    mpz_t Z, R;
    mpz_init(Z);
    mpz_init(R);
    mpz_ui_pow_ui(Z, 10, 100000);
    mpz_divexact(R, Z, Z);
    return 0;
}


gdb backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x00007fa2f2b5245d in mpn_submul_1 () from
/usr/local/src/pari/local/lib/libmpir.so.8
(gdb) bt
#0  0x00007fa2f2b5245d in mpn_submul_1 () from
/usr/local/src/pari/local/lib/libmpir.so.8
#1  0x00007fa2f2b73e72 in __gmpn_sb_divappr_q () from
/usr/local/src/pari/local/lib/libmpir.so.8
#2  0x00007fa2f2b812f2 in __gmpn_inv_divappr_q () from
/usr/local/src/pari/local/lib/libmpir.so.8
#3  0x00007fa2f2b88765 in __gmpn_divexact () from
/usr/local/src/pari/local/lib/libmpir.so.8
#4  0x00007fa2f2b3fb4b in __gmpz_divexact () from
/usr/local/src/pari/local/lib/libmpir.so.8
#5  0x0000000000400741 in main () at mpirtest.c:8


My system is:

$ uname -a
Linux arcanis 2.6.32-gentoo-r7 #5 SMP Thu Jun 10 23:07:26 CEST 2010
x86_64 Intel(R) Core(TM)2 Duo CPU T5870 @ 2.00GHz GenuineIntel GNU/Linux

$ ./config.guess
core2-unknown-linux-gnu

$ gcc --version
gcc-4.4.3 (Gentoo 4.4.3-r2 p1.2) 4.4.3

This is with MPIR 2.1.1 configured with ./configure --enable-gmpcompat


This bug was found thanks to Sage (see
http://trac.sagemath.org/sage_trac/ticket/9837)


Jeroen Demeyer.

-- 
You received this message because you are subscribed to the Google Groups 
"mpir-devel" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/mpir-devel?hl=en.

Reply via email to