[sundials-users] [Pkg-octave-devel] Sundials
Aaron Collier
collier6 at llnl.gov
Wed Jun 14 19:07:18 UTC 2006
Dear Rafael,
Thank you for bringing the problem to our attention. Although we
sincerely appreciate the patch you provided, we opted instead to change
the variable type from 'unsigned int' to 'void *'.
Respectfully,
Aaron Collier
Rafael Laboissiere wrote:
> Dear SUNDIALS developers,
>
> First of all, let me introduce myself: I am a member of the Debian Octave
> Group, which is currently maintaining the sundials package in Debian. I
> am contacting you about a compilation issue that has been recently
> raised.
>
> The Debian project decided 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). One should instead use
> intptr_t, defined in stdint.h, probably by doing conditional compilation
> on HAVE_STDINT_H.
>
> I prepared a patch for fixing the problem, which is attached below. This
> patch was successfully tested on both i386 and amd64 architectures with
> stdint.h present. It is slightly convoluted, because the topdir config.h
> file need to be #include'd in cvodea.h. This file is generated by
> configure, but is not included by any other source file.
>
> Best regards,
>
> Rafael
>
>
> [1] http://lists.debian.org/debian-devel-announce/2006/06/msg00004.html
> [2] http://people.debian.org/~tbm/logs/pointer/
>
>
> ------------------------------------------------------------------------
>
> --- sundials-2.2.0.orig/cvodes/include/cvodea.h
> +++ sundials-2.2.0/cvodes/include/cvodea.h
> @@ -44,6 +44,13 @@
> #include "cvodes.h"
> #include "sundials_nvector.h"
>
> +#include "../../config.h"
> +#ifdef HAVE_STDINT_H
> +#include <stdint.h>
> +#else
> +#define intptr_t unsigned int
> +#endif
> +
> /*
> * ===============================================================
> * DEFINITIONS OF CVODEA INPUTS
> --- 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);
> }
> --- sundials-2.2.0.orig/kinsol/source/kinsol.c
> +++ sundials-2.2.0/kinsol/source/kinsol.c
> @@ -1737,7 +1737,7 @@
>
> /* If info_code = PRNT_RETVAL, decode the numeric value */
>
> - ret = (int) (va_arg(ap, int *));
> + ret = va_arg(ap, int);
>
> switch(ret) {
> case KIN_SUCCESS:
More information about the Pkg-octave-devel
mailing list