From a9bb8566c9b9c9c0d2bfea910f7dc7c718193f80 Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Fri, 7 Aug 2026 14:25:17 +0200 Subject: [PATCH 1/2] Add -O0 and runtime checks (bounds, uninit, FPE trap, NaN-init) to DEBUG build in BuildICON.cmake --- cmake/BuildICON.cmake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmake/BuildICON.cmake b/cmake/BuildICON.cmake index 82619e5b..2db15089 100644 --- a/cmake/BuildICON.cmake +++ b/cmake/BuildICON.cmake @@ -24,8 +24,14 @@ set(ICON_ECRAD_FCFLAGS "-D__ECRAD_LITTLE_ENDIAN") # Control compiler optimization depending on CMAKE_BUILD_TYPE if (CMAKE_BUILD_TYPE STREQUAL "DEBUG") - string(PREPEND ICON_CFLAGS "-g ") - string(PREPEND ICON_FCFLAGS "-g ") + string(PREPEND ICON_CFLAGS "-O0 -g ") + string(PREPEND ICON_FCFLAGS "-O0 -g ") + # Runtime diagnostics: bounds checking, trap FP exceptions, uninitialized reals with NaN + if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" OR CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM") + string(APPEND ICON_FCFLAGS " -check bounds -check uninit -fpe0 -init=snan") + elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") + string(APPEND ICON_FCFLAGS " -fcheck=bounds -ffpe-trap=invalid,zero,overflow -finit-real=snan") + endif() elseif (CMAKE_BUILD_TYPE STREQUAL "RELEASE") string(PREPEND ICON_CFLAGS "-O2 ") string(PREPEND ICON_FCFLAGS "-O2 ") From fd8b0c5d2c56c79b26fd4d4d37402722c8cd0b57 Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Sat, 8 Aug 2026 00:57:39 +0200 Subject: [PATCH 2/2] remove check uninit flag in ICON cmake --- cmake/BuildICON.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BuildICON.cmake b/cmake/BuildICON.cmake index 2db15089..470a623e 100644 --- a/cmake/BuildICON.cmake +++ b/cmake/BuildICON.cmake @@ -28,7 +28,7 @@ if (CMAKE_BUILD_TYPE STREQUAL "DEBUG") string(PREPEND ICON_FCFLAGS "-O0 -g ") # Runtime diagnostics: bounds checking, trap FP exceptions, uninitialized reals with NaN if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" OR CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM") - string(APPEND ICON_FCFLAGS " -check bounds -check uninit -fpe0 -init=snan") + string(APPEND ICON_FCFLAGS " -check bounds -fpe0 -init=snan") elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") string(APPEND ICON_FCFLAGS " -fcheck=bounds -ffpe-trap=invalid,zero,overflow -finit-real=snan") endif()