This fixes issue with GCC 14 with Debugging flags.
Testing with Intel shows this is zero-diff when running hydrostatic v11.
Also, as expected, in v12, GCC 14 Debug runs just fine since that is non-hydrostatic by default.
Testing with GCC 14 with Debugging on found a bug when running as hydrostatic:
Error termination. Backtrace:
At line 505 of file /discover/nobackup/mathomp4/SystemTests/builds/AGCM_GNU/CURRENT/GEOSgcm/src/Components/@GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSsuperdyn_GridComp/@FVdycoreCubed_GridComp/@fvdycore/model/dyn_core.F90
Fortran runtime error: Index '2' of dimension 3 of array 'w' outside of expected range (1:1)
This fixes issue with GCC 14 with Debugging flags.
Testing with Intel shows this is zero-diff when running hydrostatic v11.
Also, as expected, in v12, GCC 14 Debug runs just fine since that is non-hydrostatic by default.
Testing with GCC 14 with Debugging on found a bug when running as hydrostatic:
This is on the call to
c_sw
: https://github.com/GEOS-ESM/GFDL_atmos_cubed_sphere/blob/0dd21f5426b602a698f5dfd73b44da3a62c81fe4/model/dyn_core.F90#L502-L510The current code for allocating
w
is:The issue is that because I was running hydrostatic,
w
isw(1,1,1)
. But the call toc_sw
isdo k = 1, npz
and when it gets to the second loop, boom.So, the simple fix is to just always allocate these arrays. It is wasteful, but solves the issue.
NOTE 1: As I'm not sure how to test the
hybrid_z
bits of this, I've kept it as is. I suppose it should probably always be allocated as wellNOTE 2: From my reading of the current mothership fvdycore (which we have diverged from, but share a common ancestor), they could have the same issue there (see https://github.com/NOAA-GFDL/GFDL_atmos_cubed_sphere/blob/44e20a7d45ac1d2c3b84a6ffaa0c88b4cc3d5175/model/fv_arrays.F90#L1546-L1563 and https://github.com/NOAA-GFDL/GFDL_atmos_cubed_sphere/blob/44e20a7d45ac1d2c3b84a6ffaa0c88b4cc3d5175/model/dyn_core.F90#L440-L448). For that reason, I mention @bensonr as this might be seen by them if/when they test with GCC 14. (Though if they don't see it, I guess that says something interesting too!)