Bill Allombert on Thu, 05 Oct 2006 22:46:38 +0200

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

Re: gp2c-run causes the PARI stack overflows

On Thu, Oct 05, 2006 at 12:31:44PM -0700, Max A. wrote:
> Hello!
> I've tried to run the following simple gp program via gp2c / gp2c-run
> for(d=89,999, print1(d," "); forstep(n=d*10^9,(d+1)*10^9,4,
> if(Mod(2,n+2)^n==2,print(n," <===")) ) )
> When I run this program under gp2c-run it constantly complains that
> "the PARI stack overflows" even when I allocated 2GB for the stack!
> (see below)
> Note that the original gp program does not require much memory and
> perfectly works with the default stack size.
> What's wrong?

You must use the option -g to gp2c / gp2c-run
./gp2c-run -g

According to the documentation:

  -g tells GP2C to generate gerepile calls to clean up the
 PARI stack and reduce memory usage. You will probably need this option,
 although the C code will be easier to read or hand-edit without it.

To avoid problems I suggest to always run gp2c-run with options -g -W -pgp2c_
unless you want to read the source code...