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.

[netcdfgroup] Fwd: Fortran API issues with uninitialized data

Dear NetCDFers,

Using the NetCDF Fortran API v4.4.0rc1. When running under valgrind, my unit tests will sometimes show the following:

==26685== Thread 1:
==26685== Conditional jump or move depends on uninitialised value(s)
==26685==    at 0x72FC83E: nf_inq_dimid_ (nf_dim.f90:136)
==26685==    by 0x736B13F: __netcdf_MOD_nf90_inq_dimid (netcdf_dims.f90:21)
==26685==    by 0x6181E82: __esmfnf_mod_MOD_pio_inq_dimid (nf_mod.F90:1218)

If one looks around line 136 in nf_dim.f90, the issue is that I have
unit tests where the eventual call to nc_inq_dimid is made with a bad
ncid.  This results in a return code /= NC_NOERR.  Then, at line 136,
undefined stack trash from cdimid is used in the if test.

There are a few ways this could be fixed, including:

1.) cdimid could be initialized to something before the call to
nc_inq_dimid is made,

2.) over on the C side, nc_inq_dimid could return a reliable value for
cdimid when an error occurs,

3.) nf_inq_dimid could check for NC_NOERR before attempting to use cdimid

Other procedures in the nf_dim.f90 file have the same issue.  And of
course other files should also be checked.

Walter




  • 2014 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: