diff --git a/ompi/mpi/c/type_create_f90_complex.c b/ompi/mpi/c/type_create_f90_complex.c index 3a67238996..361ec6013c 100644 --- a/ompi/mpi/c/type_create_f90_complex.c +++ b/ompi/mpi/c/type_create_f90_complex.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -37,9 +38,13 @@ int MPI_Type_create_f90_complex(int p, int r, MPI_Datatype *newtype) { if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if ((MPI_UNDEFINED == p && MPI_UNDEFINED == r) || - (p < 0 && MPI_UNDEFINED != p) || - (r < 0 && MPI_UNDEFINED != r)) { + + /* Note: These functions accept negative integers for the p and r + * arguments. This is because for the SELECTED_COMPLEX_KIND, + * negative numbers are equivalent to zero values. See section + * 13.14.95 of the Fortran 95 standard. */ + + if ((MPI_UNDEFINED == p && MPI_UNDEFINED == r)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME); } } diff --git a/ompi/mpi/c/type_create_f90_integer.c b/ompi/mpi/c/type_create_f90_integer.c index 4618ecf4ca..8957e8cc1d 100644 --- a/ompi/mpi/c/type_create_f90_integer.c +++ b/ompi/mpi/c/type_create_f90_integer.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -36,9 +37,12 @@ int MPI_Type_create_f90_integer(int r, MPI_Datatype *newtype) { if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (r < 0) { - return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME); - } + + /* Note: These functions accept negative integers for the p and r + * arguments. This is because for the SELECTED_INTEGER_KIND, + * negative numbers are equivalent to zero values. See section + * 13.14.95 of the Fortran 95 standard. */ + } if (r > 38) *newtype = &ompi_mpi_datatype_null; diff --git a/ompi/mpi/c/type_create_f90_real.c b/ompi/mpi/c/type_create_f90_real.c index 775cf7090e..65db954143 100644 --- a/ompi/mpi/c/type_create_f90_real.c +++ b/ompi/mpi/c/type_create_f90_real.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -38,9 +39,13 @@ int MPI_Type_create_f90_real(int p, int r, MPI_Datatype *newtype) { if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if ((MPI_UNDEFINED == p && MPI_UNDEFINED == r) || - (p < 0 && MPI_UNDEFINED != p) || - (r < 0 && MPI_UNDEFINED != r)) { + + /* Note: These functions accept negative integers for the p and r + * arguments. This is because for the SELECTED_REAL_KIND, + * negative numbers are equivalent to zero values. See section + * 13.14.95 of the Fortran 95 standard. */ + + if ((MPI_UNDEFINED == p && MPI_UNDEFINED == r)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME); } }