[MacPorts] #47182: netcdf-fortran 4.4.2: Seg fault in nf90_get_att

MacPorts noreply at macports.org
Tue Mar 17 16:17:18 PDT 2015


#47182: netcdf-fortran 4.4.2: Seg fault in nf90_get_att
-------------------------------------------------+-------------------------
 Reporter:  dave.allured@…                       |      Owner:  macports-
     Type:  defect                               |  tickets@…
 Priority:  Normal                               |     Status:  new
Component:  ports                                |  Milestone:
 Keywords:  netcdf netcdf-fortran nf90_get_att   |    Version:  2.3.3
  nf_get_att nf_get_att_int                      |       Port:  netcdf-
                                                 |  fortran 4.4.2
-------------------------------------------------+-------------------------
 With netcdf-fortran 4.4.2, this program seg faults on the first call to
 nf90_get_att.  The function call is supposed to read a file attribute of
 type integer*2 into a program variable of integer*4.

 My current software configuration is:[[BR]]

 Mac OS X version 10.10.2[[BR]]
 Gfortran version MacPorts gcc49 4.9.2_1[[BR]]
 Netcdf-C version 4.3.3.1 (Mac ports)[[BR]]
 Netcdf-fortran version 4.4.2 (Mac ports)

 {{{
 program test
    use netcdf
    implicit none
    character(*), parameter :: infile  = 'test.nc'
    character(*), parameter :: varname = 'olr'
    character(*), parameter :: attname = 'missing_value'
    integer ncid, varid, status, ival

    print *, 'Netcdf-C version = ' // trim (nf90_inq_libvers())

    print *, 'Call nf90_open.'
    print *, '  Input file = ' // trim (infile)
    status = nf90_open (infile, nf90_nowrite, ncid)
    print '(a,i0)', '   return status = ', status
    if (status /= 0) print *, 'Error stop.'
    if (status /= 0) call exit (1)

    print *, 'Call nf90_inq_varid "' // trim (varname) // '"'
    status = nf90_inq_varid (ncid, varname, varid)
    print '(a,i0)', '   return status = ', status
    if (status /= 0) print *, 'Error stop.'
    if (status /= 0) call exit (1)

    print '(3a,i0)', '   varid for "', trim (varname), '" = ', varid

    print *, 'Call nf90_get_att for '// trim (attname)
    status = nf90_get_att (ncid, varid, attname, ival)
    print '(a,i0)', '   return status = ', status
    print '(a,i0)', '   return value = ', ival

    print *, 'End program.'
 end program test
 }}}

 Compile command:

 {{{
 gfortran -g -fcheck=all -I/opt/local/include -L/opt/local/lib -lnetcdff
 test.get-att.f90
 }}}

 Complete contents of input file, via ncdump:

 {{{
 mac56:~/bugs/netcdf/get-att.4.4 227> ncdump test.nc
 netcdf test {
 dimensions:
         time = 3 ;
 variables:
         short olr(time) ;
                 olr:missing_value = 99s ;
 data:

  olr = 10, 20, 30 ;
 }
 }}}

 Console output of test program:

 {{{
 mac56:~/bugs/netcdf/get-att.4.4 225> ./a.out
  Netcdf-C version = 4.3.3.1 of Mar  9 2015 07:31:25 $
  Call nf90_open.
    Input file = test.nc
    return status = 0
  Call nf90_inq_varid "olr"
    return status = 0
    varid for "olr" = 1
  Call nf90_get_att for missing_value

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

 Backtrace for this error:
 #0  0x104484fbc
 #1  0x1044854df
 #2  0x7fff8f666f19
 Segmentation fault
 }}}

-- 
Ticket URL: <https://trac.macports.org/ticket/47182>
MacPorts <https://www.macports.org/>
Ports system for OS X


More information about the macports-tickets mailing list