diff --git a/CHANGELOG.md b/CHANGELOG.md index 77eff2a150e..75a0765869d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -92,6 +92,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 @@ -102,6 +109,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