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

GCC 14.1 is currently unusable with FMS2 IO #641

Open
marshallward opened this issue May 18, 2024 · 0 comments
Open

GCC 14.1 is currently unusable with FMS2 IO #641

marshallward opened this issue May 18, 2024 · 0 comments

Comments

@marshallward
Copy link
Member

Currently MOM6 cannot be used with FMS2 IO when compiled with GCC 14.1 We get the following error:

$ cd .testing
$ make
PATH="/home/marshall/.local/bin:/home/marshall/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/home/marshall/gfdl/mom6/ac" FCFLAGS="-g -O0" REPORT_ERROR_LOGS="" make -C deps lib/libFMS.a
make[1]: Entering directory '/home/marshall/gfdl/mom6/.testing/deps'
make -C fms/build libFMS.a
make[2]: Entering directory '/home/marshall/gfdl/mom6/.testing/deps/fms/build'
mpifort -DPACKAGE_NAME=\"FMS\" -DPACKAGE_TARNAME=\"fms\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"FMS\" -DPACKAGE_BUGREPORT=\"https://github.com/NOAA-GFDL/FMS/issues\" -DPACKAGE_URL=\"\" -DHAVE_MPI=1 -DHAVE_GETTID=1 -DHAVE_SCHED_GETAFFINITY=1 -DHAVE_MPI=1 -Duse_libMPI=1 -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_NETCDF_H=1 -Duse_netCDF=1 -g -O0 -fcray-pointer -fdefault-real-8 -fdefault-double-8 -fallow-invalid-boz -fallow-argument-mismatch  -c ../src/fms2_io/netcdf_io.F90 -I../src/fms2_io/include
register_variable_attribute.inc:56:60:

internal compiler error: in gfc_walk_array_ref, at fortran/trans-array.cc:11870
0x1ffd19a internal_error(char const*, ...)
	???:0
0x6f365f fancy_abort(char const*, int, char const*)
	???:0
0x844964 gfc_walk_expr(gfc_expr*)
	???:0
0x884767 gfc_conv_procedure_call(gfc_se*, gfc_symbol*, gfc_actual_arglist*, gfc_expr*, vec<tree_node*, va_gc, vl_embed>*)
	???:0
0x8833b3 gfc_conv_expr_reference(gfc_se*, gfc_expr*)
	???:0
0x886ed3 gfc_conv_procedure_call(gfc_se*, gfc_symbol*, gfc_actual_arglist*, gfc_expr*, vec<tree_node*, va_gc, vl_embed>*)
	???:0
0x8d252c gfc_trans_block_construct(gfc_code*)
	???:0
0x8c7980 gfc_trans_select_type(gfc_code*)
	???:0
0x8d252c gfc_trans_block_construct(gfc_code*)
	???:0
0x8c0caa gfc_trans_if(gfc_code*)
	???:0
0x87dcd7 gfc_generate_function_code(gfc_namespace*)
	???:0
0x839c89 gfc_generate_module_code(gfc_namespace*)
	???:0
0x7f1c4f gfc_parse_file()
	???:0
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues> for instructions.
make[2]: *** [Makefile.dep:235: netcdf_io.o] Error 1
make[2]: Leaving directory '/home/marshall/gfdl/mom6/.testing/deps/fms/build'
make[1]: *** [Makefile:45: fms/build/libFMS.a] Error 2
make[1]: Leaving directory '/home/marshall/gfdl/mom6/.testing/deps'
make: *** [Makefile:342: deps/lib/libFMS.a] Error 2

The problem appears to be lines like this in FMS:

        err = nf90_put_att(fileobj%ncid, varid, trim(attribute_name), &
                           trim(attribute_value(1:str_len)))

and the problem is with trim(attribute_value(1:str_len)) inside of the function call, or something to that effect. (There are few other instances of this sort of operation in FMS).

It appears that removing the (1:str_len) slice fixes the problem. However, this slice operation was included to avoid some issues with PGI Fortran.

I see two ways to resolve this:

  • Remove the slice operators in FMS2, then point to this updated version. However, this will require careful testing of 2024.01 in our regression suite, which may introduce even more problems. (I know of at least one.)
  • Disable FMS2 in GitHub Actions, at the cost of not detecting future FMS2 issues.

My opinion: I prefer the first solution, but it will take more time. I am ok with the second solution, as long as we do not stop working on the first.

Relevant issues:

This appears in our MacOS testing because its Homebrew packages currently point to GCC 14.1. This is not any unique to MacOS platforms.

There has been a recent GCC update to 14.1.1, but it does appear to resolve this problem.

$ gfortran --version
GNU Fortran (GCC) 14.1.1 20240507

While not strictly a MOM6 issue, this affects our ability to use FMS2 with the latest GCC.

@adcroft adcroft linked a pull request May 18, 2024 that will close this issue
@adcroft adcroft removed a link to a pull request May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant