Bill Allombert on Sun, 13 Jun 2004 14:35:19 +0200


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

Re: patch for a `soft stack limit'


On Thu, Jan 15, 2004 at 10:55:09PM +0100, Bill Allombert wrote:
> I fixed only new_chunk(). There are others routines that can raise
> errpile but I consider this is a bug.

The patch below fix that (independently of whether vbot is implemented).

Cheers,
Bill

Index: src/basemath/bibli1.c
===================================================================
RCS file: /home/cvs/pari/src/basemath/bibli1.c,v
retrieving revision 1.235
diff -u -r1.235 bibli1.c
--- src/basemath/bibli1.c	6 Jun 2004 09:02:37 -0000	1.235
+++ src/basemath/bibli1.c	13 Jun 2004 12:17:41 -0000
@@ -1894,23 +1894,20 @@
 void
 init_dalloc()
 { /* correct alignment for dalloc */
-  avma -= avma % sizeof(double);
-  if (avma < bot) err(errpile);
+  new_chunk((avma % sizeof(double)) / sizeof(long));
 }
 
 double *
 dalloc(size_t n)
 {
-  if (avma - bot < n) err(errpile);
-  avma -= n; return (double*)avma;
+  return (double*)new_chunk(n / sizeof(long));
 }
 
 char *
 stackmalloc(size_t N)
 {
-  size_t n = nchar2nlong(N) * sizeof(long);
-  if (avma - bot < n) err(errpile);
-  avma -= n; return (char*)avma;
+  long n = nchar2nlong(N);
+  return (char*)new_chunk(n);
 }
 
 static double