@@ -939,8 +939,8 @@ subroutine init_intracom(comp_rank, comp_comm, num_iotasks, num_aggregator, stri
939939 integer (i4), intent (in ) :: rearr
940940 type (iosystem_desc_t), intent (out ) :: iosystem ! io descriptor to initalize
941941 integer (i4), intent (in ),optional :: base
942- type (pio_rearr_opt_t), intent (in ), optional :: rearr_opts
943-
942+ type (pio_rearr_opt_t), intent (in ), target , optional :: rearr_opts
943+
944944 integer :: lbase
945945 integer :: ierr
946946 interface
@@ -953,7 +953,7 @@ integer(c_int) function PIOc_Init_Intracomm_from_F90(f90_comp_comm, num_iotasks,
953953 integer (C_INT), value :: stride
954954 integer (C_INT), value :: base
955955 integer (C_INT), value :: rearr
956- type (pio_rearr_opt_t ) :: rearr_opts
956+ type (C_PTR ) :: rearr_opts
957957 integer (C_INT) :: iosysidp
958958 end function PIOc_Init_Intracomm_from_F90
959959 end interface
@@ -966,8 +966,11 @@ end function PIOc_Init_Intracomm_from_F90
966966#endif
967967 lbase= 0
968968 if (present (base)) lbase= base
969- ierr = PIOc_Init_Intracomm_from_F90(comp_comm,num_iotasks,stride,lbase,rearr,rearr_opts,iosystem% iosysid)
970-
969+ if (present (rearr_opts)) then
970+ ierr = PIOc_Init_Intracomm_from_F90(comp_comm,num_iotasks,stride,lbase,rearr,C_LOC(rearr_opts),iosystem% iosysid)
971+ else
972+ ierr = PIOc_Init_Intracomm_from_F90(comp_comm,num_iotasks,stride,lbase,rearr,C_NULL_PTR,iosystem% iosysid)
973+ endif
971974 call CheckMPIReturn(" Bad Initialization in PIO_Init_Intracomm: " , ierr,__FILE__,__LINE__)
972975#ifdef TIMING
973976 call t_stopf(" PIO:init" )
0 commit comments