Skip to content

Commit

Permalink
Workaround for Cray compiler bug
Browse files Browse the repository at this point in the history
A workaround has been introduced for a bug in the Cray compiler, where the
NULL() intrinsic fails to return a pointer of the correct type. Rather than
using NULL() directly as a subroutine argument, it is assigned to a variable
which is passed to the subroutines.
  • Loading branch information
Jesse Lentz authored and Jesse Lentz committed Jul 26, 2024
1 parent 116408f commit 1b8ba22
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions diag_manager/fms_diag_object.F90
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ integer function fms_register_diag_field_obj &
integer, allocatable :: file_ids(:) !< The file IDs for this variable
integer :: i !< For do loops
integer, allocatable :: diag_field_indices(:) !< indices where the field was found in the yaml
class(diagDomain_t), pointer :: null_ptr => NULL() !< Workaround for a Cray compiler bug
#endif
#ifndef use_yaml
fms_register_diag_field_obj = DIAG_FIELD_NOT_FOUND
Expand Down Expand Up @@ -267,7 +268,7 @@ integer function fms_register_diag_field_obj &
call fileptr%add_field_and_yaml_id(fieldptr%get_id(), diag_field_indices(i))
call fileptr%add_buffer_id(fieldptr%buffer_ids(i))
if(fieldptr%get_type_of_domain() .eq. NO_DOMAIN) then
call fileptr%set_file_domain(NULL(), fieldptr%get_type_of_domain())
call fileptr%set_file_domain(null_ptr, fieldptr%get_type_of_domain())
else
call fileptr%set_file_domain(fieldptr%get_domain(), fieldptr%get_type_of_domain())
endif
Expand All @@ -284,7 +285,7 @@ integer function fms_register_diag_field_obj &
call fileptr%add_buffer_id(fieldptr%buffer_ids(i))
call fileptr%init_diurnal_axis(this%diag_axis, this%registered_axis, diag_field_indices(i))
if(fieldptr%get_type_of_domain() .eq. NO_DOMAIN) then
call fileptr%set_file_domain(NULL(), fieldptr%get_type_of_domain())
call fileptr%set_file_domain(null_ptr, fieldptr%get_type_of_domain())
else
call fileptr%set_file_domain(fieldptr%get_domain(), fieldptr%get_type_of_domain())
endif
Expand Down

0 comments on commit 1b8ba22

Please sign in to comment.