Skip to content

Commit

Permalink
fixes stopping on exceptions when using nagfor
Browse files Browse the repository at this point in the history
  • Loading branch information
brtnfld committed Oct 11, 2023
1 parent 9197721 commit 0ba705c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
4 changes: 4 additions & 0 deletions config/cmake/HDFFortranCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ 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 (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
Expand Down
2 changes: 1 addition & 1 deletion config/linux-gnulibc1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 12 additions & 3 deletions fortran/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions hl/fortran/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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">)
Expand Down
6 changes: 6 additions & 0 deletions release_docs/RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 0ba705c

Please sign in to comment.