Skip to content

Commit f41ca41

Browse files
authored
add more compiler runtime checks and enable by default (#2)
1 parent 5afd684 commit f41ca41

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ if (NOT CMAKE_CONFIGURATION_TYPES) # ignore for multi-config generators like MSV
4343
endif()
4444

4545
set(ARCH_CUSTOM "" CACHE STRING "Name of custom architecture configuration to use")
46+
option(DISABLE_RUNTIME_CHECKS "Disable compiler runtime checks in Release mode" OFF)
4647
option(DEBUG_ARCH "Print arch files debug information" OFF)
4748
option(DEBUG_GLOBAL_DEFINITIONS "Print global preprocessor definitions applied to all source files" OFF)
4849

@@ -124,6 +125,11 @@ set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${Fortran_checked}")
124125
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${Fortran_optimized}")
125126
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${Fortran_preprocess} ${Fortran_io} ${Fortran_other}")
126127

128+
if (NOT DISABLE_RUNTIME_CHECKS)
129+
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${C_checked}")
130+
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${Fortran_checked}")
131+
endif()
132+
127133
if (SAVE_TEMPS)
128134
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_temps}")
129135
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${Fortran_temps}")

cmake/arch/default/GNU_Fortran.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Copyright 2018 M. Riechert and D. Meyer. Licensed under the MIT License.
22

3-
set(checked "-fbounds-check")
3+
set(checked "-fcheck=bounds,do,mem,pointer")
44
set(preprocess "-cpp")
55
set(io "-fconvert=big-endian -frecord-marker=4")
66
set(other "-ffree-line-length-none")

cmake/arch/default/Intel_Fortran_UNIX.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Copyright 2018 M. Riechert and D. Meyer. Licensed under the MIT License.
22

3-
set(checked "-check bounds")
3+
set(checked "-check noarg_temp_created,bounds,format,output_conversion,pointers,uninit")
44
set(preprocess "-fpp")
55
set(io "-convert big_endian -assume byterecl")
66
set(optimized "-align all -fno-alias")

0 commit comments

Comments
 (0)