From 20547eacfe3d5b1699cec6b74a7acd309372fca9 Mon Sep 17 00:00:00 2001 From: Tom Clune Date: Tue, 1 Aug 2023 09:23:29 -0400 Subject: [PATCH 1/2] Fixes #2274 Workaround for issue with NAG and `ESMF_Config` SetAttribute() --- CHANGELOG.md | 2 ++ base/MAPL_Config.F90 | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53d30a37ac5f..88706c5d6217 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Workaround for NAG which prevents reading values from ESMF Config files that have been set using `SetAttribute()`. The immediate issue appears to be due to a wrong CPP conditional on `ESMF_HAS_ACHAR_BUG', but it is not immediately clear if this is due to recent changes in ESMF or some change in NAG. Probably ESMF though. Once the ESMF core team analyzes we will potentially update this fix. + ### Removed ### Deprecated diff --git a/base/MAPL_Config.F90 b/base/MAPL_Config.F90 index 23050c5ea88c..510b13186939 100644 --- a/base/MAPL_Config.F90 +++ b/base/MAPL_Config.F90 @@ -42,11 +42,11 @@ function MAPL_ConfigCreate(unusable, rc) result(config) integer, optional, intent(out) :: rc character, parameter :: EOB = achar(00) !! end of buffer mark (null) -#ifdef ESMF_HAS_ACHAR_BUG +!!$#ifdef ESMF_HAS_ACHAR_BUG character, parameter :: EOL = achar(12) !! end of line mark (cr) -#else - character, parameter :: EOL = achar(10) !! end of line mark (newline) -#endif +!!$#else +!!$ character, parameter :: EOL = achar(10) !! end of line mark (newline) +!!$#endif character, parameter :: NUL = achar(00) !! what it says _UNUSED_DUMMY(unusable) From 085647e770918f054f54660b05e505d7b45c2c46 Mon Sep 17 00:00:00 2001 From: Tom Clune Date: Tue, 1 Aug 2023 09:55:18 -0400 Subject: [PATCH 2/2] Changes needed in each routine. --- base/MAPL_Config.F90 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/base/MAPL_Config.F90 b/base/MAPL_Config.F90 index 510b13186939..48840ca33343 100644 --- a/base/MAPL_Config.F90 +++ b/base/MAPL_Config.F90 @@ -42,11 +42,11 @@ function MAPL_ConfigCreate(unusable, rc) result(config) integer, optional, intent(out) :: rc character, parameter :: EOB = achar(00) !! end of buffer mark (null) -!!$#ifdef ESMF_HAS_ACHAR_BUG +#if defined(ESMF_HAS_ACHAR_BUG) | defined(__NAG_COMPILER_BUILD) character, parameter :: EOL = achar(12) !! end of line mark (cr) -!!$#else -!!$ character, parameter :: EOL = achar(10) !! end of line mark (newline) -!!$#endif +#else + character, parameter :: EOL = achar(10) !! end of line mark (newline) +#endif character, parameter :: NUL = achar(00) !! what it says _UNUSED_DUMMY(unusable) @@ -95,7 +95,7 @@ subroutine MAPL_ConfigSetAttribute_real64( config, value, label, rc ) character, parameter :: BLK = achar(32) ! blank (space) character, parameter :: TAB = achar(09) ! TAB -#ifdef ESMF_HAS_ACHAR_BUG +#if defined(ESMF_HAS_ACHAR_BUG) | defined(__NAG_COMPILER_BUILD) character, parameter :: EOL = achar(12) ! end of line mark (cr) #else character, parameter :: EOL = achar(10) ! end of line mark (newline) @@ -264,7 +264,7 @@ subroutine MAPL_ConfigSetAttribute_real32( config, value, label, rc ) character, parameter :: BLK = achar(32) ! blank (space) character, parameter :: TAB = achar(09) ! TAB -#ifdef ESMF_HAS_ACHAR_BUG +#if defined(ESMF_HAS_ACHAR_BUG) | defined(__NAG_COMPILER_BUILD) character, parameter :: EOL = achar(12) ! end of line mark (cr) #else character, parameter :: EOL = achar(10) ! end of line mark (newline) @@ -433,7 +433,7 @@ subroutine MAPL_ConfigSetAttribute_int32( config, value, label, rc ) character, parameter :: BLK = achar(32) ! blank (space) character, parameter :: TAB = achar(09) ! TAB -#ifdef ESMF_HAS_ACHAR_BUG +#if defined(ESMF_HAS_ACHAR_BUG) | defined(__NAG_COMPILER_BUILD) character, parameter :: EOL = achar(12) ! end of line mark (cr) #else character, parameter :: EOL = achar(10) ! end of line mark (newline) @@ -678,7 +678,7 @@ subroutine MAPL_ConfigSetAttribute_string(config, value, label, rc) character, parameter :: BLK = achar(32) ! blank (space) character, parameter :: TAB = achar(09) ! TAB -#ifdef ESMF_HAS_ACHAR_BUG +#if defined(ESMF_HAS_ACHAR_BUG) | defined(__NAG_COMPILER_BUILD) character, parameter :: EOL = achar(12) ! end of line mark (cr) #else character, parameter :: EOL = achar(10) ! end of line mark (newline)