GEOS-ESM / GFDL_atmos_cubed_sphere

The GFDL atmos_cubed_sphere dynamical core code
Other
0 stars 2 forks source link

Fix uninitialized variables for GCC 13 #96

Closed mathomp4 closed 7 months ago

mathomp4 commented 7 months ago

NOTE: View changes with whitespace off:

https://github.com/GEOS-ESM/GFDL_atmos_cubed_sphere/pull/96/files?w=1

as my editor cleans up trailing spaces.


This PR fixes an issue found by @tclune and @atrayano in their AIST work and in my work with GCC 13.

The issue GCC 13 found was that because these variables that control FMS diagnostic use in FV3 were not being set code like this:

           if( idiag%id_te>0 ) then
               used = send_data(idiag%id_te, teq, fv_time)
           endif

was being triggered. I guess Intel must set uninit integers to zero, but GCC 13 does not. So, when memory space is shifted enough, things like idiag%id_te could be randomly greater than zero. This then triggers the if-block and send_data will only work if diag_manager_init is called. This is not done in FV3 and you end up with:

FATAL from PE    31: diag_manager_mod::send_data_3d: diag_manager NOT initialized

I will test this along with https://github.com/GEOS-ESM/FVdycoreCubed_GridComp/pull/280 with both Intel and GCC to make sure it is zero diff.