Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inline post restart issue with gnu compiler #321

Merged
merged 4 commits into from
Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions io/post_gfs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,13 @@ 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Fortran compiler specifications do not state that the tests in an if clause will be executed ini the order written. You need to do the following to be fully compliant:

if (associated(paramset)) then
  if (size(paramset)>0) then

Copy link
Collaborator Author

@junwang-noaa junwang-noaa Jun 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the size(paramset) is 1 but associated(paramset) is false with gnu compiler.

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)
Expand Down
10 changes: 6 additions & 4 deletions io/post_regional.F90
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,13 @@ 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How? If associated(paramset) (means it's a pointer) is false, how can the size be 1?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is what I got when I tried with gnu compiler. The issue happened when it tried to get the size of paramset(1)%param.

I think it would be best to make the same changes as in lines 161-162, 165-166.

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)
Expand Down