@@ -543,11 +543,13 @@ int32_t ompi_datatype_init( void )
543
543
544
544
#define MOOG (name , index ) \
545
545
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; \
551
553
} while(0)
552
554
553
555
/*
@@ -653,7 +655,7 @@ int32_t ompi_datatype_init( void )
653
655
/**
654
656
* Now make sure all non-contiguous types are marked as such.
655
657
*/
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 ++ ) {
657
659
opal_datatype_t * datatype = (opal_datatype_t * )opal_pointer_array_get_item (& ompi_datatype_f_to_c_table , i );
658
660
659
661
if ( (datatype -> ub - datatype -> lb ) == (ptrdiff_t )datatype -> size ) {
@@ -676,7 +678,7 @@ int32_t ompi_datatype_finalize( void )
676
678
/* As they are statically allocated they cannot be released.
677
679
* But we can call OBJ_DESTRUCT, just to free all internally allocated ressources.
678
680
*/
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 ++ ) {
680
682
opal_datatype_t * datatype = (opal_datatype_t * )opal_pointer_array_get_item (& ompi_datatype_f_to_c_table , i );
681
683
OBJ_DESTRUCT (datatype );
682
684
}
0 commit comments