Skip to content

Commit c5bb2bc

Browse files
committed
Set intent(out) stub MOM_generic_tracer arguments
Added code to set all intent(out) arguments in the stub version of the MOM_generic_tracer routines MOM_generic_tracer_stock(), MOM_generic_tracer_min_max() and MOM_generic_tracer_get() to avoid compile-time warnings. These stub routines are never supposed to be used, and there would be a fatal error during the registration phase if they are used. The values that are set in these stub routines are extremely large or otherwise nonsensical so that it would make it easier to debug them if they were used accidentally. All answers are bitwise identical in any cases that run successfully.
1 parent 5ac077f commit c5bb2bc

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

config_src/external/GFDL_ocean_BGC/MOM_generic_tracer.F90

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module MOM_generic_tracer
1616
! ### These imports should not reach into FMS directly ###
1717

1818
use MOM_ALE_sponge, only : ALE_sponge_CS
19-
use MOM_coms, only : EFP_type
19+
use MOM_coms, only : EFP_type, real_to_EFP
2020
use MOM_diag_mediator, only : diag_ctrl
2121
use MOM_error_handler, only : MOM_error, FATAL
2222
use MOM_file_parser, only : param_file_type
@@ -195,8 +195,14 @@ function MOM_generic_tracer_stock(h, stocks, G, GV, CS, names, units, stock_inde
195195
integer :: MOM_generic_tracer_stock !< Return value, the
196196
!! number of stocks calculated here.
197197

198+
integer :: m
198199
MOM_generic_tracer_stock = 0
199200

201+
! These should never be used, but they are set to avoid compile-time warnings
202+
do m=1,size(names) ; names(m) = "" ; enddo
203+
do m=1,size(units) ; units(m) = "" ; enddo
204+
do m=1,size(stocks) ; stocks(m) = real_to_EFP(0.0) ; enddo
205+
200206
end function MOM_generic_tracer_stock
201207

202208
!> This subroutine finds the global min and max of either of all available
@@ -227,8 +233,24 @@ function MOM_generic_tracer_min_max(ind_start, got_minmax, gmin, gmax, G, CS, na
227233
integer :: MOM_generic_tracer_min_max !< Return value, the
228234
!! number of tracers done here.
229235

236+
integer :: m
237+
230238
MOM_generic_tracer_min_max = 0
231239

240+
! These should never be used, but they are set to avoid compile-time warnings. Note that the minimum values
241+
! are delibarately set to be larger than the maximum values.
242+
got_minmax(:) = .false.
243+
gmax(:) = -huge(gmax)
244+
gmin(:) = huge(gmin)
245+
do m=1,size(names) ; names(m) = "" ; enddo
246+
do m=1,size(units) ; units(m) = "" ; enddo
247+
if (present(xgmin)) xgmin(:) = 0.0
248+
if (present(ygmin)) ygmin(:) = 0.0
249+
if (present(zgmin)) zgmin(:) = 0.0
250+
if (present(xgmax)) xgmax(:) = 0.0
251+
if (present(ygmax)) ygmax(:) = 0.0
252+
if (present(zgmax)) zgmax(:) = 0.0
253+
232254
end function MOM_generic_tracer_min_max
233255

234256
!> This subroutine calculates the surface state and sets coupler values for
@@ -271,6 +293,8 @@ subroutine MOM_generic_tracer_get(name,member,array, CS)
271293
! arbitrary units [A]
272294
character(len=128), parameter :: sub_name = 'MOM_generic_tracer_get'
273295

296+
array(:,:,:) = huge(array)
297+
274298
end subroutine MOM_generic_tracer_get
275299

276300
!> This subroutine deallocates the memory owned by this module.

0 commit comments

Comments
 (0)