WIP: Fix for GCC 14. Always allocate NH arrays #104
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
:GFDL_atmos_cubed_sphere/model/dyn_core.F90
Lines 502 to 510 in 0dd21f5
The 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!)