Opened 3 years ago
Closed 3 years ago
#2720 closed Defect (fixed)
Use of non-standard intrinsic function ISNAN
Reported by: | smueller | Owned by: | smueller |
---|---|---|---|
Priority: | low | Milestone: | |
Component: | env | Version: | v4.0.* |
Severity: | minor | Keywords: | compilation, lib_fortran |
Cc: |
Description
Context
The compilation of source:/NEMO/releases/r4.0/r4.0.6/src/OCE/stpctl.F90#L173 fails on some architectures.
Analysis
The intrinsic function ISNAN is non-standard and does not seem to be supported by all commonly used Fortran compilers. Instead, recent Fortran standards require the availability of the function ieee_is_nan from the intrinsic module ieee_arithmetic.
Recommendation
An optional wrapper function with the name ISNAN that calls the ieee_is_nan function is proposed to be included in source:/NEMO/releases/r4.0/r4.0-HEAD/src/OCE/lib_fortran.F90,
-
src/OCE/lib_fortran.F90
21 21 USE in_out_manager ! I/O manager 22 22 USE lib_mpp ! distributed memory computing 23 23 USE lbclnk ! ocean lateral boundary conditions 24 USE, INTRINSIC :: ieee_arithmetic 24 25 25 26 IMPLICIT NONE 26 27 PRIVATE … … 34 35 #if defined key_nosignedzero 35 36 PUBLIC SIGN 36 37 #endif 38 #if defined key_noisnan 39 PUBLIC ISNAN 40 #endif 37 41 38 42 INTERFACE glob_sum 39 43 MODULE PROCEDURE glob_sum_1d, glob_sum_2d, glob_sum_3d … … 485 489 END FUNCTION SIGN_ARRAY_3D_B 486 490 #endif 487 491 492 #if defined key_noisnan 493 !$AGRIF_DO_NOT_TREAT 494 FUNCTION ISNAN(pa) 495 USE, INTRINSIC :: ieee_arithmetic 496 REAL(wp), INTENT(in) :: pa 497 LOGICAL :: ISNAN 498 ISNAN = ieee_is_nan(pa) 499 END FUNCTION ISNAN 500 !$AGRIF_END_DO_NOT_TREAT 501 #endif 502 488 503 !!====================================================================== 489 504 END MODULE lib_fortran
and to be made available (if defined) in module stpctl through
-
src/OCE/stpctl.F90
25 25 USE lib_mpp ! distributed memory computing 26 26 USE zdf_oce , ONLY : ln_zad_Aimp ! ocean vertical physics variables 27 27 USE wet_dry, ONLY : ll_wd, ssh_ref ! reference depth for negative bathy 28 28 USE lib_fortran 29 29 USE netcdf ! NetCDF library 30 30 IMPLICIT NONE 31 31 PRIVATE
This wrapper function can be activated by defining the pre-processor key key_noisnan in architecture files that configure the compilation using Fortran compilers without support for the ISNAN intrinsic function; it is protected from AGRIF pre-processing to avoid problems from using intrinsic module ieee_arithmetic in AGRIF-processed source code.
Commit History (1)
Changeset | Author | Time | ChangeLog |
---|---|---|---|
15371 | smueller | 2021-10-14T17:02:36+02:00 | Optional replacement of non-standard intrinsic function ISNAN (ticket #2720) |
Change History (3)
comment:1 Changed 3 years ago by smueller
comment:2 Changed 3 years ago by smueller
- Owner set to smueller
- Status changed from new to assigned
comment:3 Changed 3 years ago by smueller
- Resolution set to fixed
- Status changed from assigned to closed
source:/NEMO/releases/r4.0/r4.0-HEAD@15371 has passed the standard SETTE tests.
In 15371: