From d02112bcb0cdef7f714985bba7b09f81d632cd23 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Tue, 10 Sep 2024 14:22:49 -0600 Subject: [PATCH] Fix a valgrind uninitialized conditional error in cosp The modified line was causing this error: ==19971== Conditional jump or move depends on uninitialised value(s) ==19971== at 0xA47583: __mod_cosp_MOD_cosp_simulator (cosp.F90:502) ... when cospOUT%isccp_meantb is not allocated. I noticed all surrounding accesses of members of cospOUT were guarded by association checks, so I added that check. --- src/cosp.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cosp.F90 b/src/cosp.F90 index 8594451859..109348910a 100755 --- a/src/cosp.F90 +++ b/src/cosp.F90 @@ -499,7 +499,7 @@ function COSP_SIMULATOR(cospIN,cospgridIN,cospOUT,start_idx,stop_idx,debug) Lrttov_column = .true. ! Set flag to deallocate rttov types (only done on final call to simulator) - if (size(cospOUT%isccp_meantb) .eq. stop_idx) lrttov_cleanUp = .true. + if (associated(cospOUT%isccp_meantb) .and. size(cospOUT%isccp_meantb) .eq. stop_idx) lrttov_cleanUp = .true. ! ISCCP column if (associated(cospOUT%isccp_fq) .or. &