Description: Make Lcalc allocate a larger PARI stack
Author: Julien Puydt <julien.puydt@laposte.net>
Date: Mon, 2 Feb 2015 11:00:00 +0100
Bug-Debian: http://bugs.debian.org/776802

diff --git a/include/Lcommandline.h b/include/Lcommandline.h
index 9562055..ab1f171 100644
--- a/include/Lcommandline.h
+++ b/include/Lcommandline.h
@@ -40,11 +40,7 @@
 #include "Lcommandline_globals.h"      //command line global variables
 #ifdef INCLUDE_PARI
 #include "pari/pari.h"     //for pari's elliptic curve functions
-#undef init                //pari has a '#define init pari_init' which
-                           //causes trouble with the stream.h init.
-                           //pari also causes trouble with things like abs.
-                           //we place the pari include first since otherwise it
-                           //messes up.
+#include "pari/paripriv.h" // for pari_init_stack
 
 #endif //ifdef INCLUDE_PARI
 
diff --git a/src/Lcommandline.cc b/src/Lcommandline.cc
index 35efb9d..5beba86 100644
--- a/src/Lcommandline.cc
+++ b/src/Lcommandline.cc
@@ -473,7 +473,7 @@ int main (int argc, char *argv[])
 
 #ifdef INCLUDE_PARI
         if(do_elliptic_curve){
-             allocatemem((int) N_terms*16+1000000); //XXXXXXXXX this should depend on whether we're double or long double or mpfr double
+             pari_init_stack((size_t)N_terms*16 + 1000000, top-bot); // Allocate bigger PARI stack
              if (my_verbose>0) cout << "Will precompute " << N_terms << " elliptic L-function dirichlet coefficients..." << endl;
              initialize_new_L(a1,a2,a3,a4,a6,N_terms); 
         }
