Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jun 20, 2024

Conversation

mgduda
Copy link
Contributor

@mgduda mgduda commented Jun 20, 2024

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.

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 commit 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.
@mgduda mgduda requested a review from ldfowler58 June 20, 2024 20:04
@ldfowler58
Copy link
Contributor

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.

@mgduda mgduda merged commit 7070294 into MPAS-Dev:develop Jun 20, 2024
@mgduda mgduda deleted the atmosphere/noahmp_no_f2008_flag branch June 20, 2024 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants