[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
mpz_gcd segfault
From: |
Tom Womack |
Subject: |
mpz_gcd segfault |
Date: |
Thu, 9 Dec 2004 22:18:52 -0000 |
Summary: segfault in gmpn_gcd when computing the GCD of an enormous (1512583
limbs) and a moderate (845 limbs) number
This was discovered for the enormous number = product of primes between 2^25
and 2^26, and moderate number = 2^27038 with the base-10 digits reversed;
since the enormous number is 6MB long, I hope I can get away with not
attaching it.
Trying to replicate with
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "gmp.h"
int main(int argc, char** argv)
{
mpz_t A,B,C;
gmp_randstate_t state;
gmp_randinit_default(state);
gmp_randseed_ui(state, 3);
mpz_urandomb(A, state, 48402688);
mpz_urandomb(B, state, 845*32);
mpz_gcd(C,A,B);
}
gives a segfault in the mpz_urandomb call. Backtrace is
#0 0x4003d051 in __gmpn_copyi () from /usr/lib/libgmp.so.3
#1 0x40023012 in __gmp_randinit_lc_2exp () from /usr/lib/libgmp.so.3
#2 0x4002310d in __gmp_rand () from /usr/lib/libgmp.so.3
#3 0x400331f8 in __gmpz_urandomb () from /usr/lib/libgmp.so.3
#4 0x0804861b in main (argc=1, argv=0xbffffca4) at use-gcds-BUG.c:14
I'm using debian 3.0 (kernel 2.4.28), gcc-2.95.4 and gmp-4.0.1.
It may be this is all fixed in the current version of gmp; I've reported it
to debian too.
Tom
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- mpz_gcd segfault,
Tom Womack <=