From 691b433a39bdc8082684d0ac252c9640c172cd13 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Wed, 15 Jul 2026 15:22:40 -0400 Subject: [PATCH 1/5] Remove __GFORTRAN__ workarounds, enforce min version Enforce minimum gfortran versions (14.4, 15.2, 16.1) in CMakeLists.txt via a compiler version check, since these were the versions where a gfortran bug preventing direct assignment to derived-type actual results was fixed. With this floor in place, remove the __GFORTRAN__ workaround subroutines in GenericGridComp.F90, StateRegistry_Extensions_smod.F90, and GenericCoupler.F90 in favor of plain assignment. Also remove the dead BUILD_SHARED_MAPL option and MAPL_LIBRARY_TYPE logic, left over from MAPL v2 and no longer used. Fixes #5258 --- CHANGELOG.md | 9 ++++++ CMakeLists.txt | 23 +++++++++----- superstructure/generic/GenericGridComp.F90 | 17 ----------- .../StateRegistry_Extensions_smod.F90 | 20 ++----------- .../generic/transforms/GenericCoupler.F90 | 30 +++++-------------- 5 files changed, 36 insertions(+), 63 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d83df9d481..07c3226b5b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add helper script for regression test work - For ACG, only declare pointer and get_pointer for MAPL_STATEITEM_FIELD - For ACG, add spec_filters to generalize testing specs +- Enforce minimum supported gfortran versions (14.4, 15.2, 16.1) in `CMakeLists.txt` + via a `CMAKE_Fortran_COMPILER_VERSION` check that fails the configure step with + `FATAL_ERROR` on older, buggy compiler releases; with this floor in place, the + `__GFORTRAN__`-guarded workaround subroutines for direct assignment to + derived-type actual results (previously needed due to a gfortran bug) were + removed from `GenericGridComp.F90`, `StateRegistry_Extensions_smod.F90`, and + `GenericCoupler.F90` in favor of plain assignment ### Fixed @@ -88,6 +95,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed +- Dead `BUILD_SHARED_MAPL` option and `MAPL_LIBRARY_TYPE` logic in `CMakeLists.txt`, + left over from MAPL v2 and no longer used - Removed `ESMF_HCONFIGSET_HAS_INTENT_INOUT` preprocessor conditionals now that ESMF 9.0.0 is required (≥ 8.9.0, where `ESMF_HConfigSet` gained `intent(inout)`). The `intent(inout)` declarations in `HConfigUtilities.F90`, `OuterMetaComponent.F90`, diff --git a/CMakeLists.txt b/CMakeLists.txt index a59f715fa8f..791ca61d6d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,14 +68,23 @@ list (PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") # automatic build-tree RPATH (absolute paths) for targets in the build tree. set (CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) -option (BUILD_SHARED_MAPL "Build shared MAPL libraries" ON) -if (BUILD_SHARED_MAPL) - set (MAPL_LIBRARY_TYPE SHARED) -else () - set (MAPL_LIBRARY_TYPE STATIC) +# MAPL3 only supports gfortran 14.4+, 15.2+, and 16.1+ due do +# compiler issues with older versions +if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") + set(_version "${CMAKE_Fortran_COMPILER_VERSION}") + + if(_version VERSION_LESS "14.4" + OR (_version VERSION_GREATER_EQUAL "15.0" + AND _version VERSION_LESS "15.2") + OR (_version VERSION_GREATER_EQUAL "16.0" + AND _version VERSION_LESS "16.1")) + message(FATAL_ERROR + "Unsupported GNU Fortran version ${_version}. " + "Minimum supported versions are 14.4 for GCC 14, " + "15.2 for GCC 15, and 16.1 for GCC 16." + ) + endif() endif() -message (STATUS "Building MAPL as ${MAPL_LIBRARY_TYPE} libraries") - # Some users of MAPL build GFE libraries inline with their application # using an add_subdirectory() call rather than as a pre-build library. diff --git a/superstructure/generic/GenericGridComp.F90 b/superstructure/generic/GenericGridComp.F90 index 102f8d823b9..9eac6be46b9 100644 --- a/superstructure/generic/GenericGridComp.F90 +++ b/superstructure/generic/GenericGridComp.F90 @@ -117,28 +117,11 @@ recursive type(ESMF_GridComp) function create_grid_comp_primary( & ! must be processed later as the information gets stored in the ComponentSpec. user_gc_driver = GriddedComponentDriver(user_gridcomp) -#ifndef __GFORTRAN__ outer_meta = OuterMetaComponent(gridcomp, user_gc_driver, set_services, config) -#else - ! GFortran 12 & 13 cannot directly assign to outer_meta. But - ! the assignment works for an object without the POINTER - ! attribute. An internal procedure is a workaround, but - ! ... ridiculous. - call ridiculous(outer_meta, OuterMetaComponent(gridcomp, user_gc_driver, set_services, config)) -#endif call outer_meta%init_meta(_RC) _RETURN(ESMF_SUCCESS) _UNUSED_DUMMY(unusable) -#ifdef __GFORTRAN__ - contains - - subroutine ridiculous(a, b) - type(OuterMetaComponent), intent(out) :: a - type(OuterMetaComponent), intent(in) :: b - a = b - end subroutine ridiculous -#endif end function create_grid_comp_primary diff --git a/superstructure/generic/registry/StateRegistry_Extensions_smod.F90 b/superstructure/generic/registry/StateRegistry_Extensions_smod.F90 index 90448d5d431..199c2d18dbc 100644 --- a/superstructure/generic/registry/StateRegistry_Extensions_smod.F90 +++ b/superstructure/generic/registry/StateRegistry_Extensions_smod.F90 @@ -39,27 +39,13 @@ module subroutine add_family(this, virtual_pt, family, rc) integer :: status type(ExtensionFamily), pointer :: new_family - + call this%add_virtual_pt(virtual_pt, _RC) new_family => this%family_map%at(virtual_pt, _RC) -#ifndef __GFORTRAN__ new_family = family -#else - call ridiculous(new_family, family) -#endif _RETURN(_SUCCESS) -#ifdef __GFORTRAN__ - contains - - subroutine ridiculous(a, b) - type(ExtensionFamily), intent(out) :: a - type(ExtensionFamily), intent(in) :: b - a = b - end subroutine ridiculous -#endif - end subroutine add_family module subroutine add_primary_spec(this, virtual_pt, spec, rc) @@ -74,7 +60,7 @@ module subroutine add_primary_spec(this, virtual_pt, spec, rc) call this%owned_items%push_back(spec) family = ExtensionFamily(this%owned_items%back()) call this%add_family(virtual_pt, family, _RC) - + _RETURN(_SUCCESS) end subroutine add_primary_spec @@ -215,7 +201,7 @@ recursive module function extend(registry, v_pt, goal_spec, rc) result(extension ! Leave commented code here. This should be migrated to use pflogger in the future. ! Useful debugging point. - + !# block !# type(StateItemSpec), pointer :: spec !# spec => closest_extension diff --git a/superstructure/generic/transforms/GenericCoupler.F90 b/superstructure/generic/transforms/GenericCoupler.F90 index 4cb60d302a3..69684e847d0 100644 --- a/superstructure/generic/transforms/GenericCoupler.F90 +++ b/superstructure/generic/transforms/GenericCoupler.F90 @@ -38,27 +38,13 @@ function make_coupler(transform, source, rc) result(coupler_gridcomp) coupler_gridcomp = ESMF_GridCompCreate(name=name, contextFlag=ESMF_CONTEXT_PARENT_VM, _RC) call attach_coupler_meta(coupler_gridcomp, _RC) coupler_meta => get_coupler_meta(coupler_gridcomp, _RC) -#ifndef __GFORTRAN__ coupler_meta = CouplerMetaComponent(transform, source) -#else - call ridiculous(coupler_meta, CouplerMetaComponent(transform,source)) -#endif call ESMF_GridCompSetServices(coupler_gridComp, setServices, _RC) _RETURN(_SUCCESS) - contains - -#ifdef __GFORTRAN__ - subroutine ridiculous(a, b) - type(CouplerMetaComponent), intent(out) :: a - type(CouplerMetaComponent), intent(in) :: b - a = b - end subroutine ridiculous -#endif - end function make_coupler - + subroutine setServices(gridcomp, rc) type(ESMF_GridComp) :: gridcomp integer, intent(out) :: rc @@ -81,7 +67,7 @@ recursive subroutine initialize(gridcomp, importState, exportState, clock, rc) type(ESMF_State) :: exportState type(ESMF_Clock) :: clock integer, intent(out) :: rc - + integer :: status type(CouplerMetaComponent), pointer :: meta @@ -98,7 +84,7 @@ recursive subroutine update(gridcomp, importState, exportState, clock, rc) type(ESMF_State) :: exportState type(ESMF_Clock) :: clock integer, intent(out) :: rc - + integer :: status type(CouplerMetaComponent), pointer :: meta @@ -109,14 +95,14 @@ recursive subroutine update(gridcomp, importState, exportState, clock, rc) _RETURN(_SUCCESS) end subroutine update - + recursive subroutine invalidate(gridcomp, importState, exportState, clock, rc) type(ESMF_GridComp) :: gridcomp type(ESMF_State) :: importState type(ESMF_State) :: exportState type(ESMF_Clock) :: clock integer, intent(out) :: rc - + integer :: status type(CouplerMetaComponent), pointer :: meta @@ -134,16 +120,16 @@ recursive subroutine clock_advance(gridcomp, importState, exportState, clock, rc type(ESMF_State) :: exportState type(ESMF_Clock) :: clock integer, intent(out) :: rc - + integer :: status type(CouplerMetaComponent), pointer :: coupler_meta - + coupler_meta => get_coupler_meta(gridcomp) call coupler_meta%clock_advance(importState, exportState, clock, _RC) ! TBD: is this where it belongs? call ESMF_ClockAdvance(clock, _RC) - + _RETURN(_SUCCESS) end subroutine clock_advance From f5a183a9f68e12a61a8ccf7ab5813331b43afd5b Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 16 Jul 2026 09:46:54 -0400 Subject: [PATCH 2/5] Test GCC 15 Spack CI --- .github/workflows/spack-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spack-ci.yml b/.github/workflows/spack-ci.yml index d2ab9829626..8b4fe53945b 100644 --- a/.github/workflows/spack-ci.yml +++ b/.github/workflows/spack-ci.yml @@ -31,7 +31,7 @@ jobs: - name: "develop" use-esmf-develop: true run-tests: true - uses: GEOS-ESM/CI-workflows/.github/workflows/spack_gcc_build.yml@project/geosgcm + uses: GEOS-ESM/CI-workflows/.github/workflows/spack_gcc_build.yml@project/geosgcm-gcc15 name: Spack Build with ESMF (${{ matrix.name }}) secrets: BUILDCACHE_USERNAME: ${{ secrets.BUILDCACHE_USERNAME }} From 7b42fe4705ddc8df71bf7fb56d526960aea2dbb8 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 16 Jul 2026 10:00:57 -0400 Subject: [PATCH 3/5] Trivial commit to trigger CI. --- .github/workflows/spack-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/spack-ci.yml b/.github/workflows/spack-ci.yml index 8b4fe53945b..898bed51436 100644 --- a/.github/workflows/spack-ci.yml +++ b/.github/workflows/spack-ci.yml @@ -31,6 +31,7 @@ jobs: - name: "develop" use-esmf-develop: true run-tests: true + # This uses GCC 15 as the compiler now uses: GEOS-ESM/CI-workflows/.github/workflows/spack_gcc_build.yml@project/geosgcm-gcc15 name: Spack Build with ESMF (${{ matrix.name }}) secrets: From 3f77aac44b9ac339535059189870cc1f87fda5d9 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 16 Jul 2026 10:10:44 -0400 Subject: [PATCH 4/5] Trivial commit to trigger CI. Part 2 --- .github/workflows/spack-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spack-ci.yml b/.github/workflows/spack-ci.yml index 898bed51436..d39417f1410 100644 --- a/.github/workflows/spack-ci.yml +++ b/.github/workflows/spack-ci.yml @@ -31,7 +31,7 @@ jobs: - name: "develop" use-esmf-develop: true run-tests: true - # This uses GCC 15 as the compiler now + # This uses GCC 15 as the compiler now. This also installs GCC 15 uses: GEOS-ESM/CI-workflows/.github/workflows/spack_gcc_build.yml@project/geosgcm-gcc15 name: Spack Build with ESMF (${{ matrix.name }}) secrets: From 9ab9eee3408335e4ff43c44f58a211f708949a47 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 16 Jul 2026 12:00:57 -0400 Subject: [PATCH 5/5] Back to project/geosgcm --- .github/workflows/spack-ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/spack-ci.yml b/.github/workflows/spack-ci.yml index d39417f1410..d2ab9829626 100644 --- a/.github/workflows/spack-ci.yml +++ b/.github/workflows/spack-ci.yml @@ -31,8 +31,7 @@ jobs: - name: "develop" use-esmf-develop: true run-tests: true - # This uses GCC 15 as the compiler now. This also installs GCC 15 - uses: GEOS-ESM/CI-workflows/.github/workflows/spack_gcc_build.yml@project/geosgcm-gcc15 + uses: GEOS-ESM/CI-workflows/.github/workflows/spack_gcc_build.yml@project/geosgcm name: Spack Build with ESMF (${{ matrix.name }}) secrets: BUILDCACHE_USERNAME: ${{ secrets.BUILDCACHE_USERNAME }}