NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
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:
==5375== ==5375== Conditional jump or move depends on uninitialised value(s) ==5375== at 0x80CA23F: kill_trailing ==5375== by 0x80CA500: nf_inq_dim_ ==5375== by 0x80C8855: __netcdf_MOD_nf90_inquire_dimension ==5375== by 0x805ADE4: __srf_netcdf_io_MOD_readdim ==5375== by 0x805D8D3: __srf_netcdf_io_MOD_inquire_srf_netcdf ==5375== by 0x8067E42: __srf_netcdf_io_MOD_read_srf_netcdf ==5375== by 0x8071363: MAIN__ ==5375== by 0x80E65BD: main (fmain.c:21) ==5375== ==5375== More than 100000 total errors detected. I'm not reporting any more. ==5375== Final error counts will be inaccurate. Go fix your program! ==5375== Rerun with --error-limit=no to disable this cutoff. Note ==5375== that errors may occur in your program without prior warning from ==5375== Valgrind, because errors are no longer being displayed. ==5375== (all the "srf_..." stuff is my code). 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 in my readdim() call (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.
Has anyone seen this error before? I looked through the support archives but no joy. Haven't received a reply yet from the support folks either. Anyone have any ideas on how I can determine why I am getting this valgrind error? The C code is goobledegook to me.
I should point out that the program results itself are correct and there are no memory leaks reported - it's just the output from valgrind that indicates this particular 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++
netcdfgroup
archives: