[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SegFault in 2**111111111 calculation
From: |
Kevin Ryde |
Subject: |
Re: SegFault in 2**111111111 calculation |
Date: |
07 Dec 2000 06:54:04 +1000 |
User-agent: |
Gnus/5.0807 (Gnus v5.8.7) Emacs/20.5 |
Pearu Peterson <address@hidden> writes:
>
> mpz_pow_ui(b,b,EX);
> ...
Sylvain Pion <address@hidden> writes:
>
> I think it's a stack size problem. If you set "limit stacksize
> 512M" in your shell, then it works. Default is 8MB on linux, and I
> think I remember seeing in the GMP doc that it sometimes stores
> temporaries on the stack.
Yes, that looks like it. mpz_pow_ui doesn't do anything special for
base==2, and will allocate a lot of memory with TMP_ALLOC, which is
alloca unless using --disable-alloca. ulimit -s will reveal the
current stack size limit.
mpz_mul_2exp is the right function for 2**n, though perhaps pow_ui
should have a quick test for a power of 2 base.
Re: SegFault in 2**111111111 calculation,
Kevin Ryde <=