[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netCDF #EBD-881732]: kill_trailing problem(?) when running
- Subject: [netCDF #EBD-881732]: kill_trailing problem(?) when running
- Date: Mon, 29 Sep 2008 11:07:02 -0600
> Hello,
>
> I use netCDF 3.6.1 and the Fortran90 API.
>
> I run my Fortran95 code through valgrind (see http://valgrind.org) to check
for memory
> leaks. I am getting the following output from valgrind when I do so:
>
> ==2560== Conditional jump or move depends on uninitialised value(s)
> ==2560== at 0x80C4E87: kill_trailing (in
> /trunk/Utility/InstrumentInfo/SRF/Test_SRF/Test_SRF)
> ==2560== by 0x80C5160: nf_inq_dim_ (in
/trunk/Utility/InstrumentInfo/SRF/Test_SRF/Test_SRF)
> ==2560== by 0x80C34B5: __netcdf_MOD_nf90_inquire_dimension (in
> /trunk/Utility/InstrumentInfo/SRF/Test_SRF/Test_SRF)
> ==2560== by 0x805AD28: __srf_netcdf_io_MOD_readdim (in
> /trunk/Utility/InstrumentInfo/SRF/Test_SRF/Test_SRF)
> ==2560== by 0x805D5D3: __srf_netcdf_io_MOD_inquire_srf_netcdf (in
> /trunk/Utility/InstrumentInfo/SRF/Test_SRF/Test_SRF)
> ==2560== by 0x806098C: __srf_netcdf_io_MOD_write_srf_netcdf (in
> /trunk/Utility/InstrumentInfo/SRF/Test_SRF/Test_SRF)
> ==2560== by 0x806C5D0: MAIN__ (in
/trunk/Utility/InstrumentInfo/SRF/Test_SRF/Test_SRF)
> ==2560== by 0x80E121D: main (fmain.c:21)
> ==2560==
>
> The readdim() function above is a wrapper in my netcdf I/O module that
returns a dimension
> value given its name:
>
> FUNCTION ReadDim( NC_FileId,DimName,DimValue ) RESULT( Error_Status )
> ! Arguments
> INTEGER, INTENT(IN) :: NC_FileId
> CHARACTER(*), INTENT(IN) :: DimName
> INTEGER, INTENT(OUT) :: DimValue
> ! Function result
> INTEGER :: Error_Status
> ! Local variables
> INTEGER :: NF90_Status
> INTEGER :: id
> ! Setup
> Error_Status = SUCCESS
> ! Get the dimension id
> NF90_Status = NF90_INQ_DIMID( NC_FileId,TRIM(DimName),id )
> IF ( NF90_Status /= NF90_NOERR ) THEN
> <snip error handling>
> RETURN
> END IF
> ! Get the dimension value
> NF90_Status = NF90_INQUIRE_DIMENSION( NC_FileId,id,Len=DimValue )
> IF ( NF90_Status /= NF90_NOERR ) THEN
> <snip error handling>
> RETURN
> END IF
> END FUNCTION ReadDim
>
>
> The only reference to kill_trailing I could find is in cfortran.h (shown
below)
>
>
> /* kill the trailing char t's in string s. */
> #ifndef __CF__KnR
> static char *kill_trailing(char *s, char t)
> #else
> static char *kill_trailing( s, t) char *s; char t;
> #endif
> {char *e;
> e = s + strlen(s);
> if (e>s) { /* Need this to handle NULL string.*/
> while (e>s && *--e==t); /* Don't follow t's past beginning. */
> e[*e==t?0:1] = '\0'; /* Handle s[0]=t correctly. */
> } return s; }
>
>
> I'm wondering why I am getting the kill_trailing error in reference to the
> NF90_INQUIRE_DIMENSION() call - there are no strings there to truncate
(assuming I am
> understanding what kill_trailing is being used for.) I assume the nf_inq_dim
translates to
> the nc_inq_dim and that somehwere along the way strings are involved.
>
> Do you have any ideas on how I can determine why I am getting this memory
error? I should
> point out that the program results are correct - it's just the output from
valgrind that
> indicates any sort of problem.
>
> cheers,
>
> paulv
>
>
> p.s. I compiled the netcdf libraries using gfortran
>
> $ gfortran --version
> GNU Fortran (GCC) 4.4.0 20080302 (experimental) [trunk revision 132813]
>
> with the flags
>
> export CC=/usr/bin/gcc
> export CPPFLAGS='-DNDEBUG -DpgiFortran'
> export CFLAGS=-O
> export FC=gfortran
> export F90=gfortran
> export FFLAGS=-fno-second-underscore
> export F90FLAGS=-fno-second-underscore
> export CXX=/usr/bin/g++
>
>
Howdy Paul,
Sorry I have not responded to this message yet - I've been swamped with support
and windows problems for the past several weeks!
I don't know what is going on with this, but it is on the list of issues to be
investigated, and I will let you know what I figure out...
Thanks,
Ed
Ticket Details
===================
Ticket ID: EBD-881732
Department: Support netCDF
Priority: Normal
Status: Open