Skip to content

Commit a5e9c35

Browse files
committed
ompi/mpi: Fix MPI_UNDEFINED handling in mpi_type_create_f90_(real|complex)
Signed-off-by: Joshua Hursey <[email protected]>
1 parent 5e302f5 commit a5e9c35

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

ompi/mpi/c/type_create_f90_complex.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ static const char FUNC_NAME[] = "MPI_Type_create_f90_complex";
4646
int MPI_Type_create_f90_complex(int p, int r, MPI_Datatype *newtype)
4747
{
4848
uint64_t key;
49+
int p_key, r_key;
4950

5051
OPAL_CR_NOOP_PROGRESS();
5152

@@ -65,8 +66,10 @@ int MPI_Type_create_f90_complex(int p, int r, MPI_Datatype *newtype)
6566
/* if the user does not care about p or r set them to 0 so the
6667
* test associate with them will always succeed.
6768
*/
68-
if( MPI_UNDEFINED == p ) p = 0;
69-
if( MPI_UNDEFINED == r ) r = 0;
69+
p_key = p;
70+
r_key = r;
71+
if( MPI_UNDEFINED == p ) p_key = 0;
72+
if( MPI_UNDEFINED == r ) r_key = 0;
7073

7174
/**
7275
* With respect to the MPI standard, MPI-2.0 Sect. 10.2.5, MPI_TYPE_CREATE_F90_xxxx,
@@ -87,7 +90,7 @@ int MPI_Type_create_f90_complex(int p, int r, MPI_Datatype *newtype)
8790
const int* a_i[2];
8891
int rc;
8992

90-
key = (((uint64_t)p) << 32) | ((uint64_t)r);
93+
key = (((uint64_t)p_key) << 32) | ((uint64_t)r_key);
9194
if( OPAL_SUCCESS == opal_hash_table_get_value_uint64( &ompi_mpi_f90_complex_hashtable,
9295
key, (void**)newtype ) ) {
9396
return MPI_SUCCESS;

ompi/mpi/c/type_create_f90_real.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ static const char FUNC_NAME[] = "MPI_Type_create_f90_real";
4646
int MPI_Type_create_f90_real(int p, int r, MPI_Datatype *newtype)
4747
{
4848
uint64_t key;
49+
int p_key, r_key;
4950

5051
OPAL_CR_NOOP_PROGRESS();
5152

@@ -65,8 +66,10 @@ int MPI_Type_create_f90_real(int p, int r, MPI_Datatype *newtype)
6566
/* if the user does not care about p or r set them to 0 so the
6667
* test associate with them will always succeed.
6768
*/
68-
if( MPI_UNDEFINED == p ) p = 0;
69-
if( MPI_UNDEFINED == r ) r = 0;
69+
p_key = p;
70+
r_key = r;
71+
if( MPI_UNDEFINED == p ) p_key = 0;
72+
if( MPI_UNDEFINED == r ) r_key = 0;
7073

7174
/**
7275
* With respect to the MPI standard, MPI-2.0 Sect. 10.2.5, MPI_TYPE_CREATE_F90_xxxx,
@@ -87,7 +90,7 @@ int MPI_Type_create_f90_real(int p, int r, MPI_Datatype *newtype)
8790
const int* a_i[2] = {&p, &r};
8891
int rc;
8992

90-
key = (((uint64_t)p) << 32) | ((uint64_t)r);
93+
key = (((uint64_t)p_key) << 32) | ((uint64_t)r_key);
9194
if( OPAL_SUCCESS == opal_hash_table_get_value_uint64( &ompi_mpi_f90_real_hashtable,
9295
key, (void**)newtype ) ) {
9396
return MPI_SUCCESS;

0 commit comments

Comments
 (0)