@@ -543,11 +543,13 @@ int32_t ompi_datatype_init( void )
543543
544544#define MOOG (name , index ) \
545545 do { \
546- ompi_mpi_##name.dt.d_f_to_c_index = \
547- opal_pointer_array_add(&ompi_datatype_f_to_c_table, &ompi_mpi_##name); \
548- if( ompi_datatype_number_of_predefined_data < (ompi_mpi_##name).dt.d_f_to_c_index ) \
549- ompi_datatype_number_of_predefined_data = (ompi_mpi_##name).dt.d_f_to_c_index; \
550- assert( (index) == ompi_mpi_##name.dt.d_f_to_c_index ); \
546+ int rc; \
547+ ompi_mpi_##name.dt.d_f_to_c_index = index; \
548+ rc = opal_pointer_array_set_item(&ompi_datatype_f_to_c_table, \
549+ index, &ompi_mpi_##name); \
550+ assert( rc == OPAL_SUCCESS ); \
551+ if( ompi_datatype_number_of_predefined_data < (ompi_mpi_##name).dt.d_f_to_c_index + 1 ) \
552+ ompi_datatype_number_of_predefined_data = (ompi_mpi_##name).dt.d_f_to_c_index + 1; \
551553 } while(0)
552554
553555 /*
@@ -653,7 +655,7 @@ int32_t ompi_datatype_init( void )
653655 /**
654656 * Now make sure all non-contiguous types are marked as such.
655657 */
656- for ( i = 0 ; i < ompi_mpi_count . dt . d_f_to_c_index ; i ++ ) {
658+ for ( i = 0 ; i < ompi_datatype_number_of_predefined_data ; i ++ ) {
657659 opal_datatype_t * datatype = (opal_datatype_t * )opal_pointer_array_get_item (& ompi_datatype_f_to_c_table , i );
658660
659661 if ( (datatype -> ub - datatype -> lb ) == (ptrdiff_t )datatype -> size ) {
@@ -676,7 +678,7 @@ int32_t ompi_datatype_finalize( void )
676678 /* As they are statically allocated they cannot be released.
677679 * But we can call OBJ_DESTRUCT, just to free all internally allocated ressources.
678680 */
679- for ( int i = 0 ; i < ompi_mpi_count . dt . d_f_to_c_index ; i ++ ) {
681+ for ( int i = 0 ; i < ompi_datatype_number_of_predefined_data ; i ++ ) {
680682 opal_datatype_t * datatype = (opal_datatype_t * )opal_pointer_array_get_item (& ompi_datatype_f_to_c_table , i );
681683 OBJ_DESTRUCT (datatype );
682684 }
0 commit comments