[Pkg-octave-devel] Sundials
Rafael Laboissiere
rafael at debian.org
Thu Jun 8 09:23:34 UTC 2006
The Debian project decided recently to switch to gcc-4.1. as the default
version of the GCC compiler [1]. Due to the more strict checks, many
packages generate warnings about casts from integer to pointer (and
vice-versa) with incompatible sizes. The build logs can be found in [2]
and the sundials package (version 2.1.1-6) is listed there.
For sundials, the warnings appear all in file cvodea.c. I checked the
sources for version 2.2.0 and noticed that the problematic code was moved
into file cvodea_io.c. The problem comes from the fact that the
"unsinged int" type is not large enough to hold a pointer in 64-bit
architectures (e.g. alpha, amd64, and ia64). The upstream authors should
instead use intptr_t, defined in stdint.h, probably by doing conditional
compilation on HAVE_STDINT_H.
I prepared a patch, which is attached below, and I would like to know
your opinion about it before sending upstream. I could only test the
changes on my i386, which is 32-bit and has stdint.h.
Rafael
[1] http://lists.debian.org/debian-devel-announce/2006/06/msg00004.html
[2] http://people.debian.org/~tbm/logs/pointer/
-------------- next part --------------
--- sundials-2.2.0.orig/cvodes/include/cvodea.h
+++ sundials-2.2.0/cvodes/include/cvodea.h
@@ -44,6 +44,10 @@
#include "cvodes.h"
#include "sundials_nvector.h"
+#ifndef HAVE_STDINT_H
+#define intptr_t unsigned int
+#endif
+
/*
* ===============================================================
* DEFINITIONS OF CVODEA INPUTS
@@ -281,8 +285,8 @@
*/
typedef struct {
- unsigned int my_addr;
- unsigned int next_addr;
+ intptr_t my_addr;
+ intptr_t next_addr;
realtype t0;
realtype t1;
long int nstep;
@@ -291,7 +295,7 @@
} CVadjCheckPointRec;
int CVadjGetCheckPointsInfo(void *cvadj_mem, CVadjCheckPointRec *ckpnt);
- int CVadjGetCurrentCheckPoint(void *cvadj_mem, unsigned int *addr);
+ int CVadjGetCurrentCheckPoint(void *cvadj_mem, intptr_t *addr);
/*
* -----------------------------------------------------------------
--- sundials-2.2.0.orig/cvodes/source/cvodea_io.c
+++ sundials-2.2.0/cvodes/source/cvodea_io.c
@@ -422,8 +422,8 @@
while (ck_mem != NULL) {
- ckpnt[i].my_addr = (unsigned int) ck_mem;
- ckpnt[i].next_addr = (unsigned int) next_;
+ ckpnt[i].my_addr = (intptr_t) ck_mem;
+ ckpnt[i].next_addr = (intptr_t) next_;
ckpnt[i].t0 = t0_;
ckpnt[i].t1 = t1_;
ckpnt[i].nstep = nst_;
@@ -445,7 +445,7 @@
* Returns the address of the 'active' check point.
*/
-int CVadjGetCurrentCheckPoint(void *cvadj_mem, unsigned int *addr)
+int CVadjGetCurrentCheckPoint(void *cvadj_mem, intptr_t *addr)
{
CVadjMem ca_mem;
@@ -455,7 +455,7 @@
}
ca_mem = (CVadjMem) cvadj_mem;
- *addr = (unsigned int) ckpntData;
+ *addr = (intptr_t) ckpntData;
return(CV_SUCCESS);
}
More information about the Pkg-octave-devel
mailing list