[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #CDZ-957605]: Floating point exception, netcdf-fortran 4.6.1



Hi Dave,

I've been out of the office on PTO, and have just returned.  Thanks for your 
patience, let me take a look and see if I can figure out what is going on with 
this.  

-Ward

> Hello netCDF support.  This simple fortran demo crashes on nf90_open with
> floating point exception, when FPE is enabled on the compile line.  See
> below, *"-ffpe-trap=invalid"*.  I can reproduce on both Mac and Linux
> systems.  Netcdf = 4.9.2, netcdf-fortran = 4.6.1.  Mac libraries built by
> Macports, Linux built by Spack I think.  Have you seen this?  What is wrong?
> 
> [Dave.Allured@hfe12 fpe]$ cat test2.fpe.f90
> program test
> use netcdf
> implicit none
> 
> character infile*80
> integer file_mode, ncid, status
> 
> call get_command_argument (1, infile)
> print *, 'Open file: ' // trim (infile)
> 
> file_mode = nf90_nowrite
> status = nf90_open (infile, file_mode, ncid)
> 
> print *, '  status = ', status
> print *, '  ncid   = ', ncid
> 
> status = nf90_close (ncid)
> end program test
> ----------------------------------------------------------------------------
> [Dave.Allured@hfe12 fpe]$ ncdump -h tmp2m.nc
> netcdf tmp2m {
> dimensions:
> site = 10 ;
> hour = 24 ;
> day = 4 ;
> variables:
> float tmp2m(site, hour, day) ;
> tmp2m:missing_value = -9999.f ;
> tmp2m:actual_range = 241.6885f, 320.8028f ;
> 
> // global attributes:
> :title = "Obs and model input data" ;
> :history = "Thu Jul 18 11:23:59 2024: ncks -d site,0,9 -d hour,0,23 -d
> day,0,3 -v tmp2m noaa_input.c84x.pm2.5.2023.AMJ.nc tmp2m.nc\n",
> "Wed Apr 17 23:08:44 2024: Make original NetCDF file.\n",
> "NetCDF writer subroutine: netwrite3.f90 v3.19.1\n",
> "NetCDF library: 4.7.0 of Mar 19 2024 15:11:32 $\n",
> "Created by write_input_arrays.f90." ;
> :NCO = "netCDF Operators version 5.2.1 (Homepage = http://nco.sf.net, Code
> = http://github.com/nco/nco, Citation = 10.1016/j.envsoft.2008.03.004)" ;
> }
> ----------------------------------------------------------------------------
> [Dave.Allured@hfe12 fpe]$ gfortran -g -Wall -ffpe-trap=invalid \
> -I/apps/netcdf/4.9.2/gnu-13.2.0/include \
> -L/apps/netcdf/4.9.2/gnu-13.2.0/lib -lnetcdff test2.fpe.f90
> ----------------------------------------------------------------------------
> [Dave.Allured@hfe12 fpe]$ ./a.out tmp2m.nc
> Open file: tmp2m.nc
> 
> Program received signal SIGFPE: Floating-point exception - erroneous
> arithmetic operation.
> 
> Backtrace for this error:
> #0  0x7f9417391b4f in ???
> #1  0x7f94163b1560 in ???
> #2  0x7f941632cc05 in ???
> #3  0x7f94163d0852 in ???
> #4  0x7f9416106322 in ???
> #5  0x7f94161a4184 in ???
> #6  0x7f9416ffd73e in ???
> #7  0x7f9417006030 in ???
> #8  0x7f9416fb491d in ???
> #9  0x7f9416fb79d8 in ???
> #10  0x7f9416fb7b33 in ???
> #11  0x7f94181978d9 in nf_open_
> at
> /tmp/role.apps/spack-stage/spack-stage-netcdf-fortran-4.6.1-7v3vc4fyter77yk3oqdla6alifyjfqyq/spack-src/fortran/nf_control.F90:189
> #12  0x7f941820d535 in __netcdf_MOD_nf90_open
> at
> /tmp/role.apps/spack-stage/spack-stage-netcdf-fortran-4.6.1-7v3vc4fyter77yk3oqdla6alifyjfqyq/spack-src/fortran/netcdf4_file.F90:64
> #13  0x400c91 in test
> at /home/Dave.Allured/test/gfortran/fpe/test2.fpe.f90:12
> #14  0x400de2 in main
> at /home/Dave.Allured/test/gfortran/fpe/test2.fpe.f90:2
> Floating exception (core dumped)
> 
> 


Ticket Details
===================
Ticket ID: CDZ-957605
Department: Support netCDF
Priority: Normal
Status: Closed
===================
NOTE: All email exchanges with NSF Unidata User Support are recorded in the 
Unidata inquiry tracking system and then made publicly available through the 
web.  If you do not want to have your interactions made available in this way, 
you must let us know in each email you send to us.