On 5/25/19 7:43 PM, Toon Moene wrote:

On 5/25/19 7:31 PM, Thomas Koenig wrote:
Hi Toon,

On 5/25/19 7:01 PM, Steve Kargl wrote:

For WRF, I suppose you or Martin could be a good citizen and
contact the project to report a bug.

I have thought about this. As a person with experience building and running weather forecasting codes, I would be first in line to try this. But the SPEC code could be modified and not resemble a fresh WRF setup ...

The current version of netcdf has, in module_netcdf_nf_interfaces.F90,

!--------------------------------- nf_put_vara_double ----------------------
Interface
  Function nf_put_vara_double(ncid, varid, start, counts, dvals) &
                                 RESULT(status)

  USE netcdf_nf_data, ONLY: RK8

  Integer,   Intent(IN) :: ncid, varid
  Integer,   Intent(IN) :: start(*), counts(*)
  Real(RK8), Intent(IN) :: dvals(*)
  Integer               :: status

  End Function nf_put_vara_double
End Interface

which looks good (well, it's not BIND(C)). In another file,
it has it as a simple INTEGER declaration with EXTERNAL.
I don't know which of the two is actually used.

OK.

One thing I can do (tomorrow) is to download WRF, build it and see how it uses netcdf.

The trunk compiler I have at hand is revision 271618, so it includes your update that's the subject of PR90539.


What I started with is some modern versions of the libraries needed: hdf5-1.10.5, netcdf-c-4.6.3, and netcdf-fortran-4.4.5, built with trunk revision 271618.

netcdf-c-4.6.3 (the C netcdf library) passed all its own tests.

netcdf-fortran-4.4.5 is the library of Fortran "glue" routines to the C library.

These are the relevant C interoperability comments during configure, indicating that it will use BIND(C) declarations for interfacing with the C library:

checking for Fortran flag to compile .f90 files... none
checking fortran 90 modules inclusion flag... -I
checking if Fortran compiler supports Fortran 2003 ISO_C_BINDING... yes
checking if Fortran compiler supports Fortran 2008 ISO_FORTRAN_ENV additions... yes
checking if Fortran compiler supports TS29113 standard extension... yes
checking whether F03 native code is desired... yes

However, there *is* a Segmentation Fault when running one of its tests:

cat nf_test/tst_f90.log

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7f915ef0d8b0 in ???
#1  0x7f915ef0cae3 in ???
#2  0x7f915eb6483f in ???
#3  0x7f915fa151cd in __netcdf_MOD_nf90_put_var_1d_fourbytereal
        at 
/home/toon/netcdf/netcdf-fortran-4.4.5/fortran/netcdf_expanded.f90:940
#4  0x402cfc in netcdftest
        at /home/toon/netcdf/netcdf-fortran-4.4.5/nf_test/tst_f90.f90:95
#5  0x40226c in main
        at /home/toon/netcdf/netcdf-fortran-4.4.5/nf_test/tst_f90.f90:7
FAIL tst_f90 (exit status: 139)

This is the error location in /home/toon/netcdf/netcdf-fortran-4.4.5/fortran/netcdf_expanded.f90:

    939        nf90_put_var_1D_FourByteReal = &
940 nf_put_vara_real(ncid, varid, localStart, localCount, values)
    941      end if
    942    end function nf90_put_var_1D_FourByteReal

So at least *a* Segmentation Fault is reproducible with these freely available libraries ....

Kind regards,

--
Toon Moene - e-mail: t...@moene.org - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
At home: http://moene.org/~toon/; weather: http://moene.org/~hirlam/
Progress of GNU Fortran: http://gcc.gnu.org/wiki/GFortran#news

Reply via email to