Skip to content

Commit 4be5a6c

Browse files
authored
Merge pull request #6159 from kawashima-fj/pr/fix-type-create-f90
mpi/c: Fix MPI_TYPE_CREATE_F90_{REAL,COMPLEX}
2 parents 260cea3 + 6fb01f6 commit 4be5a6c

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

ompi/mpi/c/type_create_f90_complex.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* and Technology (RIST). All rights reserved.
1919
* Copyright (c) 2017 IBM Corporation. All rights reserved.
2020
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
21+
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
2122
* $COPYRIGHT$
2223
*
2324
* Additional copyrights may follow
@@ -83,10 +84,10 @@ int MPI_Type_create_f90_complex(int p, int r, MPI_Datatype *newtype)
8384
* cache.
8485
*/
8586

86-
if( (LDBL_DIG < p) || (LDBL_MAX_10_EXP < r) ) *newtype = &ompi_mpi_datatype_null.dt;
87-
else if( (DBL_DIG < p) || (DBL_MAX_10_EXP < r) ) *newtype = &ompi_mpi_ldblcplex.dt;
88-
else if( (FLT_DIG < p) || (FLT_MAX_10_EXP < r) ) *newtype = &ompi_mpi_dblcplex.dt;
89-
else *newtype = &ompi_mpi_cplex.dt;
87+
if ( (LDBL_DIG < p) || (LDBL_MAX_10_EXP < r) || (-LDBL_MIN_10_EXP < r) ) *newtype = &ompi_mpi_datatype_null.dt;
88+
else if( (DBL_DIG < p) || (DBL_MAX_10_EXP < r) || (-DBL_MIN_10_EXP < r) ) *newtype = &ompi_mpi_ldblcplex.dt;
89+
else if( (FLT_DIG < p) || (FLT_MAX_10_EXP < r) || (-FLT_MIN_10_EXP < r) ) *newtype = &ompi_mpi_dblcplex.dt;
90+
else *newtype = &ompi_mpi_cplex.dt;
9091

9192
if( *newtype != &ompi_mpi_datatype_null.dt ) {
9293
ompi_datatype_t* datatype;

ompi/mpi/c/type_create_f90_real.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* and Technology (RIST). All rights reserved.
1919
* Copyright (c) 2017 IBM Corporation. All rights reserved.
2020
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
21+
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
2122
* $COPYRIGHT$
2223
*
2324
* Additional copyrights may follow
@@ -83,10 +84,10 @@ int MPI_Type_create_f90_real(int p, int r, MPI_Datatype *newtype)
8384
* cache.
8485
*/
8586

86-
if( (LDBL_DIG < p) || (LDBL_MAX_10_EXP < r) ) *newtype = &ompi_mpi_datatype_null.dt;
87-
else if( (DBL_DIG < p) || (DBL_MAX_10_EXP < r) ) *newtype = &ompi_mpi_long_double.dt;
88-
else if( (FLT_DIG < p) || (FLT_MAX_10_EXP < r) ) *newtype = &ompi_mpi_double.dt;
89-
else *newtype = &ompi_mpi_float.dt;
87+
if ( (LDBL_DIG < p) || (LDBL_MAX_10_EXP < r) || (-LDBL_MIN_10_EXP < r) ) *newtype = &ompi_mpi_datatype_null.dt;
88+
else if( (DBL_DIG < p) || (DBL_MAX_10_EXP < r) || (-DBL_MIN_10_EXP < r) ) *newtype = &ompi_mpi_long_double.dt;
89+
else if( (FLT_DIG < p) || (FLT_MAX_10_EXP < r) || (-FLT_MIN_10_EXP < r) ) *newtype = &ompi_mpi_double.dt;
90+
else *newtype = &ompi_mpi_float.dt;
9091

9192
if( *newtype != &ompi_mpi_datatype_null.dt ) {
9293
ompi_datatype_t* datatype;

0 commit comments

Comments
 (0)