From 5a89d30b0d1b211812977b729bfae0646a711e20 Mon Sep 17 00:00:00 2001 From: Jun Wang Date: Fri, 28 May 2021 15:15:10 +0000 Subject: [PATCH 1/4] fix gnu control restart test with inline post --- io/post_gfs.F90 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/io/post_gfs.F90 b/io/post_gfs.F90 index 4fb16535d..f7d385980 100644 --- a/io/post_gfs.F90 +++ b/io/post_gfs.F90 @@ -158,9 +158,11 @@ subroutine post_run_gfs(wrt_int_state,mypei,mpicomp,lead_write, & filenameflat = 'postxconfig-NT.txt' if(size(paramset)>0) then do i=1,size(paramset) - if (size(paramset(i)%param)>0) then - deallocate(paramset(i)%param) - nullify(paramset(i)%param) + if (associated(paramset(i)%param)) then + if (size(paramset(i)%param)>0) then + deallocate(paramset(i)%param) + nullify(paramset(i)%param) + endif endif enddo deallocate(paramset) From 20efe023a09ff03283b093049997af075bbc53f2 Mon Sep 17 00:00:00 2001 From: "Jun.Wang" Date: Fri, 28 May 2021 16:31:11 +0000 Subject: [PATCH 2/4] fix gnu issue in post_regional.F90 --- io/post_regional.F90 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/io/post_regional.F90 b/io/post_regional.F90 index 34c6ffcd5..840c10f89 100644 --- a/io/post_regional.F90 +++ b/io/post_regional.F90 @@ -162,9 +162,11 @@ subroutine post_run_regional(wrt_int_state,mypei,mpicomp,lead_write, & filenameflat = 'postxconfig-NT.txt' if(size(paramset)>0) then do i=1,size(paramset) - if (size(paramset(i)%param)>0) then - deallocate(paramset(i)%param) - nullify(paramset(i)%param) + if (associated(paramset(i)%param)) then + if (size(paramset(i)%param)>0) then + deallocate(paramset(i)%param) + nullify(paramset(i)%param) + endif endif enddo deallocate(paramset) From 2a409c4eabb96f8cdc0f7bb1f4515c132be344e8 Mon Sep 17 00:00:00 2001 From: "Jun.Wang" Date: Sun, 30 May 2021 02:30:03 +0000 Subject: [PATCH 3/4] fix inline post in restart test --- io/post_gfs.F90 | 2 +- io/post_regional.F90 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/io/post_gfs.F90 b/io/post_gfs.F90 index f7d385980..58d51d60e 100644 --- a/io/post_gfs.F90 +++ b/io/post_gfs.F90 @@ -156,7 +156,7 @@ subroutine post_run_gfs(wrt_int_state,mypei,mpicomp,lead_write, & if(mype==0) print *,'af read_xml at fh00,name=',trim(filenameflat) else if(ifhr > 0) then filenameflat = 'postxconfig-NT.txt' - if(size(paramset)>0) then + if(associated(paramset) .and. size(paramset)>0) then do i=1,size(paramset) if (associated(paramset(i)%param)) then if (size(paramset(i)%param)>0) then diff --git a/io/post_regional.F90 b/io/post_regional.F90 index 840c10f89..127ebb328 100644 --- a/io/post_regional.F90 +++ b/io/post_regional.F90 @@ -160,7 +160,7 @@ subroutine post_run_regional(wrt_int_state,mypei,mpicomp,lead_write, & if(mype==0) print *,'af read_xml at fh00,name=',trim(filenameflat) else if(ifhr > 0) then filenameflat = 'postxconfig-NT.txt' - if(size(paramset)>0) then + if(associated(paramset) .and. size(paramset)>0) then do i=1,size(paramset) if (associated(paramset(i)%param)) then if (size(paramset(i)%param)>0) then From b80aad10e80703cc7871386662c97e23bf3346af Mon Sep 17 00:00:00 2001 From: "Jun.Wang" Date: Tue, 1 Jun 2021 18:27:52 +0000 Subject: [PATCH 4/4] using separate if statement for data pointer check --- io/post_gfs.F90 | 22 ++++++++++++---------- io/post_regional.F90 | 18 ++++++++++-------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/io/post_gfs.F90 b/io/post_gfs.F90 index 58d51d60e..0907d7d76 100644 --- a/io/post_gfs.F90 +++ b/io/post_gfs.F90 @@ -156,17 +156,19 @@ subroutine post_run_gfs(wrt_int_state,mypei,mpicomp,lead_write, & if(mype==0) print *,'af read_xml at fh00,name=',trim(filenameflat) else if(ifhr > 0) then filenameflat = 'postxconfig-NT.txt' - if(associated(paramset) .and. size(paramset)>0) then - do i=1,size(paramset) - if (associated(paramset(i)%param)) then - if (size(paramset(i)%param)>0) then - deallocate(paramset(i)%param) - nullify(paramset(i)%param) + if(associated(paramset)) then + if( size(paramset)>0) then + do i=1,size(paramset) + if (associated(paramset(i)%param)) then + if (size(paramset(i)%param)>0) then + deallocate(paramset(i)%param) + nullify(paramset(i)%param) + endif endif - endif - enddo - deallocate(paramset) - nullify(paramset) + enddo + deallocate(paramset) + nullify(paramset) + endif endif num_pset = 0 call read_xml() diff --git a/io/post_regional.F90 b/io/post_regional.F90 index 127ebb328..773e8dcc4 100644 --- a/io/post_regional.F90 +++ b/io/post_regional.F90 @@ -160,15 +160,17 @@ subroutine post_run_regional(wrt_int_state,mypei,mpicomp,lead_write, & if(mype==0) print *,'af read_xml at fh00,name=',trim(filenameflat) else if(ifhr > 0) then filenameflat = 'postxconfig-NT.txt' - if(associated(paramset) .and. size(paramset)>0) then - do i=1,size(paramset) - if (associated(paramset(i)%param)) then - if (size(paramset(i)%param)>0) then - deallocate(paramset(i)%param) - nullify(paramset(i)%param) + if(associated(paramset)) then + if(size(paramset)>0) then + do i=1,size(paramset) + if (associated(paramset(i)%param)) then + if (size(paramset(i)%param)>0) then + deallocate(paramset(i)%param) + nullify(paramset(i)%param) + endif endif - endif - enddo + enddo + endif deallocate(paramset) nullify(paramset) endif