-
Notifications
You must be signed in to change notification settings - Fork 64
Description
We need to be able to debug auto-generated code correctly.
The Intel compiler (and possibly others) do not detect out-of-bounds errors if they are inside argument lists passed to a subroutine. We therefore need to add logic that enables the compiler to check for bounds (or do the check ourselves), check if an array is allocated etc.
This is further complicated by the presence of arrays that may or may not be allocated, depending on some condition. Example: In the UFS, 3-dim. diagnostic tracer arrays are only allocated if ldiag3d
is true.
An idea here is to have a new metadata attribute that enables debug checks, which by default is true:
debug_check = .true.
but can contain a logical expression in standard names, for the example of a 3-dim. diagnostic tracer array:
debug_check = flag_diagnostics_3D
or, for the example of an array that is only allocated if an integer is set to a certain value:
debug_check = (flag_for_microphysics_scheme == flag_for_thompson_microphysics_scheme)
or a combination, for example:
debug_check = (flag_for_microphysics_scheme == flag_for_thompson_microphysics_scheme .and. flag_for_aerosol_physics)