Skip to content

Check for whether to do rttov cleanup can fail when compiled with debug symbols #134

@brhillman

Description

@brhillman

There is a check on cospOUT%isccp_meantb at line 512 in cosp.F90 to determine whether or not to set the lrttov_cleanup flag to .true., that checks if cospOUT%isccp_meantb is associated and if size(cospOUT%isccp_meantb) == stop_idx:

    if (associated(cospOUT%isccp_meantb) .and. size(cospOUT%isccp_meantb) .eq. stop_idx) lrttov_cleanUp = .true.

This line of code will actually cause a runtime error when compiled with certain compilers with debugging flags turned on if cospOUT%isccp_meantb is not associated, because both expressions within the logical are evaluated before the logical is evaluated. For us, this shows up as:

15: At line 512 of file /global/u1/b/bhillma/codes/e3sm/branches/master/components/eam/src/physics/cosp2/external/src/cosp.F90
15: Fortran runtime error: Pointer argument 'cospout' is not associated

A simple fix here is to separately evaluate the association status of cospOUT%isccp_meantb and the size:

    ! Set flag to deallocate rttov types (only done on final call to simulator)
    if (associated(cospOUT%isccp_meantb)) then
       if (size(cospOUT%isccp_meantb) .eq. stop_idx) lrttov_cleanUp = .true.
    endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions