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

20041101: bug in netCDF 3.6.0 ncfortran.h



Arnaud,

> To: <address@hidden>
> From: "Arnaud Desitter" <address@hidden>
> Subject: bug in ncfortran.h
> Organization: ?
> Keywords: 200411011400.iA1E0evV024635 netCDF 3.6.0 Fortran ncfortran.h

The above message contained the following:

> In NetCDF 3.6.0 beta 6, there is a long standing bug in ncfortran.h.
> When defining nc_def_dim and friends and mapping them to their C
> counterpart, there is problem related to the last argument (of type
> PDIMID).  When the call to C API returns with a failure, this argment
> has not been set but is read unconditionally in the Fortran wrapper.
> A simple bug fix is to pre-set its value to -1. A patch is attached.
> 
> You can reproduce this bug by running the Fortran test suite under
> valgrind (see nf_test/Makefile).
...
> diff -ru netcdf-3_6_0-beta6-orig/src/fortran/ncfortran.h =
> netcdf-3_6_0-beta6/src/fortran/ncfortran.h=0A=
> --- netcdf-3_6_0-beta6-orig/src/fortran/ncfortran.h   2004-07-21 =
> 21:34:05.000000000 +0100=0A=
> +++ netcdf-3_6_0-beta6/src/fortran/ncfortran.h        2004-11-01 =
> 12:51:54.000000000 +0000=0A=
> @@ -473,7 +473,7 @@=0A=
>  #define PDIMID_cfTYPE                        NF_INTEGER=0A=
>  #define PDIMID_cfSTR(N,T,A,B,C,D,E)  _(CFARGS,N)(T,PDIMID,A,B,C,D,E)=0A=
>  #define PDIMID_cfH(S,U,B)=0A=
> -#define PDIMID_cfQ(B)                        int B;=0A=
> +#define PDIMID_cfQ(B)                        int B =3D -1;=0A=
>  #define PDIMID_cfT(M,I,A,B,D)                &B=0A=
>  #define PDIMID_cfR(A,B,D)            *A=3D(B =3D=3D -1 ? -1 : B+1);=0A=

Thanks for sending this in.

This change will be incorporated in the next release.

Did this "bug" result in incorrect behavior of a netCDF program or
merely a diagnostic message from a data-flow analysis program (e.g.,
lint(1))?

Regards,
Steve Emmerson

> NOTE: All email exchanges with Unidata User Support are recorded in the
> Unidata inquiry tracking system and then made publicly available
> through the web.  If you do not want to have your interactions made
> available in this way, you must let us know in each email you send to us.