Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
add gfortran flags for tracking down memory access issues
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Jan 13, 2023
1 parent 4201950 commit 945cf00
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cmake/Modules/SetFortranFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,17 @@ SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}"
"-fbacktrace" # GNU (gfortran)
"-ftrace=full" # GNU (g95)
)
# Sanitize
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}"
Fortran "-fsanitize=address" # Gnu
)


# Check everything
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}"
Fortran "-check" # Intel
"/check" # Intel Windows
"-fcheck=bounds" # GNU (New style)
"-fbounds-check" # GNU (Old style)
"-Mbounds" # Portland Group
"-fcheck=all" # GNU
)

# Initializes matrices/arrays with NaN values
Expand All @@ -142,6 +145,7 @@ SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}"
# Enables floating-point invalid, divide-by-zero, and overflow exceptions
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}"
Fortran "-fpe-all=0" # Intel
"-ffpe-trap=zero,overflow,underflow" # GNU
)

# Improves floating-point precision and consistency
Expand Down

0 comments on commit 945cf00

Please sign in to comment.