From 5640daf24bfc95cf53ee8f5f1657ed441cc144f3 Mon Sep 17 00:00:00 2001 From: Gustavo Marques Date: Wed, 18 Apr 2018 10:35:37 -0600 Subject: [PATCH] Attempt to fix deallocating unallocated arrays * This was caught by Travis, which uses gfortran. It does not happen with intel. --- src/parameterizations/vertical/MOM_diabatic_driver.F90 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/parameterizations/vertical/MOM_diabatic_driver.F90 b/src/parameterizations/vertical/MOM_diabatic_driver.F90 index 70412a716b..7f1df76192 100644 --- a/src/parameterizations/vertical/MOM_diabatic_driver.F90 +++ b/src/parameterizations/vertical/MOM_diabatic_driver.F90 @@ -2425,13 +2425,13 @@ subroutine diabatic_driver_end(CS) call entrain_diffusive_end(CS%entrain_diffusive_CSp) call set_diffusivity_end(CS%set_diff_CSp) if (CS%useKPP) then - deallocate( CS%KPP_buoy_flux ) - deallocate( CS%KPP_temp_flux ) - deallocate( CS%KPP_salt_flux ) + if (allocated(CS%KPP_buoy_flux)) deallocate( CS%KPP_buoy_flux ) + if (allocated(CS%KPP_temp_flux)) deallocate( CS%KPP_temp_flux ) + if (allocated(CS%KPP_salt_flux)) deallocate( CS%KPP_salt_flux ) endif if (CS%useKPP) then - deallocate( CS%KPP_NLTheat ) - deallocate( CS%KPP_NLTscalar ) + if (allocated(CS%KPP_NLTheat)) deallocate( CS%KPP_NLTheat ) + if (allocated(CS%KPP_NLTscalar)) deallocate( CS%KPP_NLTscalar ) call KPP_end(CS%KPP_CSp) endif