MPAS-Dev / MPAS-Model

Repository for MPAS models and shared framework releases.
231 stars 308 forks source link

Work around Noah-MP compilation issues with GNU -std=f2008 flag #1186

Closed mgduda closed 3 weeks ago

mgduda commented 3 weeks ago

This PR adds a work-around for Noah-MP compilation issues with the GNU -std=f2008 flag.

At present, the Noah-MP code fails to compile with the GNU compilers using the -std=f2008 flag, which is included in the FFLAGS set for the 'gnu' build target:

  RunoffSurfaceDynamicVicMod.F90:205:4:

    151 |                           goto 1003
        |                                   2
  ......
    205 | 1003                if ( DepthYTmp <= 0.0 ) DepthYTmp = 0.0
        |    1
  Error: Legacy Extension: Label at (1) is not in the same block as the GOTO statement at (2)
  RunoffSurfaceDynamicVicMod.F90:205:4:

    175 |                              goto 1003
        |                                      2
  ......
    205 | 1003                if ( DepthYTmp <= 0.0 ) DepthYTmp = 0.0
        |    1
  Error: Legacy Extension: Label at (1) is not in the same block as the GOTO statement at (2)

As a work-around for this issue, this PR adds logic to the Noah-MP Makefile to remove -std=f2008 if it is present in FFLAGS. The modified FFLAGS are only used when compiling Noah-MP, and so Fortran 2008 compliance is still enforced for other code when building with the 'gnu' target.

ldfowler58 commented 3 weeks ago

Using "gcc/12.2.0" and "make gnu CORE=atmosphere, I was able to compile MPAS-Model without any issues. I definitely approve the PR. Thanks for adding the bug fix in the Makefile.