The main documentation of the Finalize_Base_Structure Procedure contains additional explanation of this code listing.
subroutine Finalize_Base_Structure (Structure, status) ! Use associations. use Caesar_Flags_Module, only: uninitialized_flag ! Input/Output variable. ! Base_Structure to be finalized. type(Base_Structure_type), intent(inout) :: Structure ! Output variable. type(Status_type), intent(out), optional :: status ! Exit status. ! Internal variables. type(Status_type), dimension(8) :: deallocate_status ! Deallocation Status. type(Status_type) :: consolidated_status ! Consolidated Status. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! Verify requirements. VERIFY(Valid_State(Structure),7) ! Structure is valid. ! Unset initialization flag. Structure%Initialized = uninitialized_flag ! Set deallocation status. call Initialize (deallocate_status) call Initialize (consolidated_status) ! Finalize internals. call Finalize (Structure%Length_Vector, deallocate_status(1)) call Finalize (Structure%Locus, deallocate_status(2)) call Finalize (Structure%Length_Total, deallocate_status(3)) call Finalize (Structure%Length_PE, deallocate_status(4)) call Finalize (Structure%Last_PE, deallocate_status(5)) call Finalize (Structure%First_PE, deallocate_status(6)) call Finalize (Structure%Range_PE(1), deallocate_status(7)) call Finalize (Structure%Range_PE(2), deallocate_status(8)) ! Process status variables. consolidated_status = deallocate_status if (PRESENT(status)) then WARN_IF(Error(consolidated_status), 5) status = consolidated_status else VERIFY(Normal(consolidated_status), 5) end if call Finalize (consolidated_status) call Finalize (deallocate_status) ! Verify guarantees. VERIFY(.not.Valid_State(Structure),7) ! Structure is not valid. return end subroutine Finalize_Base_Structure