From 524d2a2dd869fa514324e5f86dfccec78f91521b Mon Sep 17 00:00:00 2001 From: Dusan Jovic Date: Fri, 12 Jul 2024 13:37:27 +0000 Subject: [PATCH 1/2] Fix do loop bounds in a2b_ord2 routine in to avoid reading from uninitialized elements of qin array Input array qin in a2b_ord2 routine is declared as qin(is-ng:ie+ng,js-ng:je+ng) but only elements in (is-1:ie+1, js-1:je+1) range are initialized in a calling routine, for example pin array in adv_pe routine in dyn_core.F90 --- model/a2b_edge.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/model/a2b_edge.F90 b/model/a2b_edge.F90 index c4530a131..0c5de7eff 100644 --- a/model/a2b_edge.F90 +++ b/model/a2b_edge.F90 @@ -377,8 +377,8 @@ subroutine a2b_ord2(qin, qout, gridstruct, npx, npy, is, ie, js, je, ng, replace if (gridstruct%bounded_domain) then - do j=js-2,je+1+2 - do i=is-2,ie+1+2 + do j=js,je+1 + do i=is,ie+1 qout(i,j) = 0.25*(qin(i-1,j-1)+qin(i,j-1)+qin(i-1,j)+qin(i,j)) enddo enddo From bb89a58601c3fa28549c291811e04d5db6c9b37b Mon Sep 17 00:00:00 2001 From: Dusan Jovic Date: Fri, 12 Jul 2024 13:48:15 +0000 Subject: [PATCH 2/2] Add '-init=snan,arrays' compiler flag to Intel debug Fortran flags (CMAKE_Fortran_FLAGS_DEBUG) --- cmake/compiler_flags_Intel_Fortran.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/compiler_flags_Intel_Fortran.cmake b/cmake/compiler_flags_Intel_Fortran.cmake index 0cfc70397..fbd667247 100644 --- a/cmake/compiler_flags_Intel_Fortran.cmake +++ b/cmake/compiler_flags_Intel_Fortran.cmake @@ -10,7 +10,7 @@ set(CMAKE_Fortran_FLAGS_REPRO "-O2 -debug minimal -fp-model consistent -qoverrid set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -debug minimal -fp-model source -qoverride-limits -qopt-prefetch=3") -set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fp-stack-check -fstack-protector-all -fpe0 -debug -ftrapuv") +set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fp-stack-check -fstack-protector-all -fpe0 -debug -ftrapuv -init=snan,arrays") set(CMAKE_Fortran_LINK_FLAGS "")