Bill Allombert on Thu, 16 Jan 2003 15:45:40 +0100


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

Re: Warning with OSF/1 cc


On Wed, Jan 15, 2003 at 06:45:12PM +0100, Bill Allombert wrote:
> Hello PARI developers,
> 
> Compiling PARI CVS with OSF/1 cc outpout warnings similar to this one
> 
> /usr/bin/cc  -c -O4 -migrate -ifo -Olimit 9999   -I. -I../src/headers -o init.o ../src/language/init.c
> cc: Warning: ../src/language/init.c, line 1217: In this statement, & before array "__env" is ignored.
>     TRY { x = lisseq(f); } ENDCATCH;
> ----^
> cc: Warning: ../src/language/init.c, line 1217: In this statement, the referenced type of the pointer value "&__env" is "long", which is not compatible with "array [84] of long".
>     TRY { x = lisseq(f); } ENDCATCH;
> ----^

Well the following patch fix this. Whether it is a good idea is left
as an excercise to the reader.
Cheers,
Bill.

Index: src/headers/paricom.h
===================================================================
RCS file: /home/megrez/cvsroot/pari/src/headers/paricom.h,v
retrieving revision 1.38
diff -u -r1.38 paricom.h
--- src/headers/paricom.h	2003/01/08 23:36:48	1.38
+++ src/headers/paricom.h	2003/01/16 14:30:43
@@ -46,7 +46,7 @@
   void *__catcherr;          \
   if ((pari_errno = setjmp(__env))) 
 
-#define RETRY { __catcherr = err_catch(__err, &__env); {
+#define RETRY { __catcherr = err_catch(__err, __env); {
 #define TRY else RETRY
 
 /* Take address of __catcher to prevent compiler from putting it into a register
Index: src/headers/paridecl.h
===================================================================
RCS file: /home/megrez/cvsroot/pari/src/headers/paridecl.h,v
retrieving revision 1.247
diff -u -r1.247 paridecl.h
--- src/headers/paridecl.h	2002/12/31 13:47:37	1.247
+++ src/headers/paridecl.h	2003/01/16 14:30:43
@@ -1024,7 +1024,7 @@
 void    disable_dbg(long val);
 GEN     dummycopy(GEN x);
 void    err(long numerr, ...);
-void   *err_catch(long errnum, jmp_buf *penv);
+void   *err_catch(long errnum, jmp_buf penv);
 void    err_leave(void **v);
 GEN     forcecopy(GEN x);
 void    freeall(void);
Index: src/language/init.c
===================================================================
RCS file: /home/megrez/cvsroot/pari/src/language/init.c,v
retrieving revision 1.182
diff -u -r1.182 init.c
--- src/language/init.c	2003/01/06 22:03:43	1.182
+++ src/language/init.c	2003/01/16 14:30:44
@@ -76,7 +76,7 @@
 #endif	/* defined BOTH_GNUPLOT_AND_X11 */
 
 typedef struct {
-  jmp_buf *penv;
+  void *penv;
   long flag;
 } cell;
 
@@ -954,7 +954,7 @@
 }
 
 void *
-err_catch(long errnum, jmp_buf *penv)
+err_catch(long errnum, jmp_buf penv)
 {
   cell *v;
   /* for fear of infinite recursion... */
@@ -1055,13 +1055,13 @@
     cell *trapped = NULL;
     if ( (trapped = err_seek(numerr)) )
     {
-      jmp_buf *e = trapped->penv;
+      void *e = trapped->penv;
       if (numerr == invmoder)
       {
         (void)va_arg(ap, char*); /* junk 1st arg */
         global_err_data = (void*)va_arg(ap, GEN);
       }
-      longjmp(*e, numerr);
+      longjmp(e, numerr);
     }
   }