| Bill Allombert on Sat, 13 Dec 2003 01:07:49 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| tentative patch to fix warning on Darwin |
Hello PARI-dev,
The buildlogs report the following warning on Darwin:
gcc -c -O3 -DGCC_INLINE -Wall -fomit-frame-pointer -no-cpp-precomp -fno-commo
n -DBOTH_GNUPLOT_AND_X11 -I. -I../src/headers -o init.o ../src/language/init.c
../src/language/init.c: In function `pari_init_stackcheck':
../src/language/init.c:224: warning: comparison is always false due to limited
range of data type
As far as I understand from looking at the code, RLIM_INFINITY is -1 but
we have casted rip.rlim_cur to a ulong so the test will always fail
(but the alternative will always succeed since (ulong)-1 is bigger than any
ulong but it is per chance).
The following patch should fix this problem (though I have not tested
it).
So if you run OS X, please tell me if this patch fix the warning and
look correct. (Please also check the value of RLIM_INFINITY on this
system).
Cheers,
Bill.
Index: src/language/init.c
===================================================================
RCS file: /home/cvs/pari/src/language/init.c,v
retrieving revision 1.211
diff -u -r1.211 init.c
--- src/language/init.c 10 Dec 2003 16:13:30 -0000 1.211
+++ src/language/init.c 12 Dec 2003 23:53:42 -0000
@@ -221,7 +221,7 @@
if (getrlimit(RLIMIT_STACK, &rip)) return;
size = rip.rlim_cur;
- if (size == RLIM_INFINITY || size > (ulong)stack_base)
+ if (size == (ulong) RLIM_INFINITY || size > (ulong)stack_base)
PARI_stack_limit = (void*)(((ulong)stack_base) / 16);
else
PARI_stack_limit = (void*)((ulong)stack_base - (size/16)*15);