summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2023-10-11 20:16:01 (GMT)
committerGitHub <noreply@github.com>2023-10-11 20:16:01 (GMT)
commit85c176247d2c434d9db535999a285daa13aa50b5 (patch)
treef2b7f2864585b3dd019d6f9adbe941d532eacc74
parent6f56d06f6af371b8b8c58079d8200647df249ee2 (diff)
downloadhdf5-85c176247d2c434d9db535999a285daa13aa50b5.zip
hdf5-85c176247d2c434d9db535999a285daa13aa50b5.tar.gz
hdf5-85c176247d2c434d9db535999a285daa13aa50b5.tar.bz2
Address nagfor exceptions stoppage. (#3658)
* added cmake ieee flag for nagfor * generalized determining the nag compiler * fixing some misc. NAG warnings
-rw-r--r--config/cmake/HDFFortranCompilerFlags.cmake5
-rw-r--r--config/linux-gnulibc14
-rw-r--r--fortran/examples/CMakeLists.txt15
-rw-r--r--fortran/src/H5Dff.F901
-rw-r--r--fortran/src/H5Sff.F902
-rw-r--r--fortran/src/H5_buildiface.F901
-rw-r--r--fortran/test/tH5D.F903
-rw-r--r--fortran/test/tH5G_1_8.F9070
-rw-r--r--hl/fortran/examples/CMakeLists.txt1
-rw-r--r--release_docs/RELEASE.txt6
10 files changed, 27 insertions, 81 deletions
diff --git a/config/cmake/HDFFortranCompilerFlags.cmake b/config/cmake/HDFFortranCompilerFlags.cmake
index 86d0431..e08df05 100644
--- a/config/cmake/HDFFortranCompilerFlags.cmake
+++ b/config/cmake/HDFFortranCompilerFlags.cmake
@@ -52,6 +52,11 @@ if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_Fortran_COMPILER_VERS
endif ()
endif ()
+if (CMAKE_Fortran_COMPILER_ID STREQUAL "NAG")
+ message (STATUS "... Select IEEE floating-point mode full")
+ list (APPEND HDF5_CMAKE_Fortran_FLAGS "-ieee=full")
+endif ()
+
if (NOT MSVC AND NOT MINGW)
# General flags
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1
index 95d7d64..9a7dbdb 100644
--- a/config/linux-gnulibc1
+++ b/config/linux-gnulibc1
@@ -92,7 +92,7 @@ else
fc_version_info=`$FC -V | grep Absoft`
;;
# The NAG compiler
- nagfor*|nagftn*)
+ *nagfor*|*nagftn*)
RM='rm -f'
tmpfile=/tmp/cmpver.$$
$FC -V >& $tmpfile
@@ -163,7 +163,7 @@ case $FC_BASENAME in
# NOTE: The default is -ieee=stop, which will cause problems
# when the H5T module performs floating-point type
# introspection
- H5_FCFLAGS="$H5_FCFLAGS -ieee=full"
+ AM_FCFLAGS="$AM_FCFLAGS -ieee=full"
FSEARCH_DIRS=""
# Production
diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt
index 3a16c23..6cbe8d6 100644
--- a/fortran/examples/CMakeLists.txt
+++ b/fortran/examples/CMakeLists.txt
@@ -35,7 +35,10 @@ set (F2003_examples
foreach (example ${examples})
add_executable (f90_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
- target_compile_options(f90_ex_${example} PRIVATE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>)
+ target_compile_options(f90_ex_${example}
+ PRIVATE
+ "${HDF5_CMAKE_Fortran_FLAGS}"
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>)
# set_property(TARGET f90_ex_${example} APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">)
# set_property(TARGET f90_ex_${example} APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>)
if(MSVC)
@@ -76,7 +79,10 @@ endforeach ()
foreach (example ${F2003_examples})
add_executable (f03_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
- target_compile_options(f03_ex_${example} PRIVATE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>)
+ target_compile_options(f03_ex_${example}
+ PRIVATE
+ "${HDF5_CMAKE_Fortran_FLAGS}"
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>)
# set_property(TARGET f03_ex_${example} APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">)
# set_property(TARGET f03_ex_${example} APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>)
if(MSVC)
@@ -117,7 +123,10 @@ endforeach ()
if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
add_executable (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90)
- target_compile_options(f90_ex_ph5example PRIVATE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>)
+ target_compile_options(f90_ex_ph5example
+ PRIVATE
+ "${HDF5_CMAKE_Fortran_FLAGS}"
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>)
# set_property(TARGET f90_ex_ph5example APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">)
# set_property(TARGET f90_ex_ph5example APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>)
if(MSVC)
diff --git a/fortran/src/H5Dff.F90 b/fortran/src/H5Dff.F90
index f4fe4ac..5d6ff52 100644
--- a/fortran/src/H5Dff.F90
+++ b/fortran/src/H5Dff.F90
@@ -1816,7 +1816,6 @@ CONTAINS
SUBROUTINE h5dwrite_reference_dsetreg(dset_id, mem_type_id, buf, dims, hdferr, &
mem_space_id, file_space_id, xfer_prp)
- USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: dset_id
INTEGER(HID_T), INTENT(IN) :: mem_type_id
diff --git a/fortran/src/H5Sff.F90 b/fortran/src/H5Sff.F90
index 5a1ca53..e734c03 100644
--- a/fortran/src/H5Sff.F90
+++ b/fortran/src/H5Sff.F90
@@ -71,7 +71,7 @@ CONTAINS
IMPLICIT NONE
INTEGER, INTENT(IN) :: rank
INTEGER(HSIZE_T), INTENT(IN) :: dims(rank)
- INTEGER(HSIZE_T), DIMENSION(:),INTENT(IN) :: maxdims(rank)
+ INTEGER(HSIZE_T), INTENT(IN) :: maxdims(rank)
INTEGER(HID_T), INTENT(OUT) :: space_id
END FUNCTION h5screate_simple_c
END INTERFACE
diff --git a/fortran/src/H5_buildiface.F90 b/fortran/src/H5_buildiface.F90
index cd4580b..62ced23 100644
--- a/fortran/src/H5_buildiface.F90
+++ b/fortran/src/H5_buildiface.F90
@@ -43,7 +43,6 @@
#include <H5config_f.inc>
PROGRAM H5_buildiface
- USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR, C_CHAR, C_LOC
IMPLICIT NONE
! These values are valid REAL KINDs (with corresponding C float) found during configure
diff --git a/fortran/test/tH5D.F90 b/fortran/test/tH5D.F90
index 8c1484f..c381235 100644
--- a/fortran/test/tH5D.F90
+++ b/fortran/test/tH5D.F90
@@ -644,7 +644,6 @@ CONTAINS
INTEGER, PARAMETER :: int_kind_16 = SELECTED_INT_KIND(18) !should map to INTEGER*8 on most modern processors
INTEGER(KIND=int_kind_1) , DIMENSION(1:DIM0), TARGET :: data_i1
INTEGER(KIND=int_kind_4) , DIMENSION(1:DIM0), TARGET :: data_i4
- INTEGER(KIND=int_kind_8) , DIMENSION(1:DIM0), TARGET :: data_i8
INTEGER(KIND=int_kind_16), DIMENSION(1:DIM0), TARGET :: data_i16
INTEGER(KIND=int_kind_1) , TARGET :: data0_i1 = 4
INTEGER(KIND=int_kind_4) , TARGET :: data0_i4 = 4
@@ -683,7 +682,6 @@ CONTAINS
! Initialize memory buffer
data_i1 = -2
data_i4 = -2
- data_i8 = -2
data_i16 = -2
data_int = -2
#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0
@@ -798,7 +796,6 @@ CONTAINS
! Initialize memory buffer
data_i1 = -2
data_i4 = -2
- data_i8 = -2
data_i16 = -2
#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0
data_i32 = -2
diff --git a/fortran/test/tH5G_1_8.F90 b/fortran/test/tH5G_1_8.F90
index dca4cf2..cd354d8 100644
--- a/fortran/test/tH5G_1_8.F90
+++ b/fortran/test/tH5G_1_8.F90
@@ -192,48 +192,18 @@ SUBROUTINE group_info(cleanup, fapl, total_error)
IF(idx_type == H5_INDEX_CRT_ORDER_F)THEN
IF(iorder == H5_ITER_INC_F)THEN
order = H5_ITER_INC_F
-!!$ IF(use_index(i))THEN
-!!$ WRITE(*,'(5x,A)')"query group info by creation order index in increasing order w/creation order index"
-!!$ ELSE
-!!$ WRITE(*,'(5x,A)')"query group info by creation order index in increasing order w/o creation order index"
-!!$ ENDIF
ELSE IF (iorder == H5_ITER_DEC_F) THEN
order = H5_ITER_DEC_F
-!!$ IF(use_index(i))THEN
-!!$ WRITE(*,'(5x,A)')"query group info by creation order index in decreasing order w/creation order index"
-!!$ ELSE
-!!$ WRITE(*,'(5x,A)')"query group info by creation order index in decreasing order w/o creation order index"
-!!$ ENDIF
ELSE
order = H5_ITER_NATIVE_F
-!!$ IF(use_index(i))THEN
-!!$ WRITE(*,'(5x,A)')"query group info by creation order index in native order w/creation order index"
-!!$ ELSE
-!!$ WRITE(*,'(5x,A)')"query group info by creation order index in native order w/o creation order index"
-!!$ ENDIF
ENDIF
ELSE
IF(iorder == H5_ITER_INC_F)THEN
order = H5_ITER_INC_F
-!!$ IF(use_index(i))THEN
-!!$ WRITE(*,'(5x,A)')"query group info by creation order index in increasing order w/creation order index"
-!!$ ELSE
-!!$ WRITE(*,'(5x,A)')"query group info by creation order index in increasing order w/o creation order index"
-!!$ ENDIF
ELSE IF (iorder == H5_ITER_DEC_F) THEN
order = H5_ITER_DEC_F
-!!$ IF(use_index(i))THEN
-!!$ WRITE(*,'(5x,A)')"query group info by creation order index in decreasing order w/creation order index"
-!!$ ELSE
-!!$ WRITE(*,'(5x,A)')"query group info by creation order index in decreasing order w/o creation order index"
-!!$ ENDIF
ELSE
order = H5_ITER_NATIVE_F
-!!$ IF(use_index(i))THEN
-!!$ WRITE(*,'(5x,A)')"query group info by creation order index in native order w/creation order index"
-!!$ ELSE
-!!$ WRITE(*,'(5x,A)')"query group info by creation order index in native order w/o creation order index"
-!!$ ENDIF
ENDIF
END IF
@@ -1263,56 +1233,16 @@ SUBROUTINE delete_by_idx(cleanup, fapl, total_error)
CHARACTER(LEN=2) :: chr2
INTEGER :: error
INTEGER :: id_type
- !
- !
- !
- CHARACTER(LEN=80) :: fix_filename1
- CHARACTER(LEN=80) :: fix_filename2
INTEGER(HSIZE_T) :: htmp
LOGICAL :: cleanup
- DO i = 1, 80
- fix_filename1(i:i) = " "
- fix_filename2(i:i) = " "
- ENDDO
-
! Loop over operating on different indices on link fields
DO idx_type = H5_INDEX_NAME_F, H5_INDEX_CRT_ORDER_F
! Loop over operating in different orders
DO iorder = H5_ITER_INC_F, H5_ITER_DEC_F
! Loop over using index for creation order value
DO i = 1, 2
- ! Print appropriate test message
-!!$ IF(idx_type == H5_INDEX_CRT_ORDER_F)THEN
-!!$ IF(iorder == H5_ITER_INC_F)THEN
-!!$ IF(use_index(i))THEN
-!!$ WRITE(*,'(5x,A)')"deleting links by creation order index in increasing order w/creation order index"
-!!$ ELSE
-!!$ WRITE(*,'(5x,A)')"deleting links by creation order index in increasing order w/o creation order index"
-!!$ ENDIF
-!!$ ELSE
-!!$ IF(use_index(i))THEN
-!!$ WRITE(*,'(5x,A)')"deleting links by creation order index in decreasing order w/creation order index"
-!!$ ELSE
-!!$ WRITE(*,'(5x,A)')"deleting links by creation order index in decreasing order w/o creation order index"
-!!$ ENDIF
-!!$ ENDIF
-!!$ ELSE
-!!$ IF(iorder == H5_ITER_INC_F)THEN
-!!$ IF(use_index(i))THEN
-!!$ WRITE(*,'(5x,A)')"deleting links by name index in increasing order w/creation order index"
-!!$ ELSE
-!!$ WRITE(*,'(5x,A)')"deleting links by name index in increasing order w/o creation order index"
-!!$ ENDIF
-!!$ ELSE
-!!$ IF(use_index(i))THEN
-!!$ WRITE(*,'(5x,A)')"deleting links by name index in decreasing order w/creation order index"
-!!$ ELSE
-!!$ WRITE(*,'(5x,A)')"deleting links by name index in decreasing order w/o creation order index"
-!!$ ENDIF
-!!$ ENDIF
-!!$ ENDIF
! Create file
CALL H5Fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error, access_prp=fapl)
diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt
index 293bc2b..caa5e78 100644
--- a/hl/fortran/examples/CMakeLists.txt
+++ b/hl/fortran/examples/CMakeLists.txt
@@ -10,6 +10,7 @@ foreach (example ${examples})
add_executable (hl_f90_ex_${example} ${HDF5_HL_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
target_compile_options(hl_f90_ex_${example}
PRIVATE
+ "${HDF5_CMAKE_Fortran_FLAGS}"
$<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
# set_property(TARGET hl_f90_ex_${example} APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">)
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 8bb32fb..bcc91df 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -1002,6 +1002,12 @@ Platforms Tested
Known Problems
==============
+ IEEE standard arithmetic enables software to raise exceptions such as overflow,
+ division by zero, and other illegal operations without interrupting or halting
+ the program flow. The HDF5 C library intentionally performs these exceptions.
+ Therefore, the "-ieee=full" nagfor switch is necessary when compiling a program
+ to avoid stopping on an exception.
+
CMake files do not behave correctly with paths containing spaces.
Do not use spaces in paths because the required escaping for handling spaces
results in very complex and fragile build files.