From b10ebf4b2d73d49c56df0c9ee93bbb010893f603 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Mon, 20 Feb 2012 14:39:15 +0000 Subject: [PATCH] Wow. This bug has existed for '''YEARS''' (probably ever since Open MPI started!). The FLAG argument to fortran attribute copy functions is a LOGICAL, meaning that it can only return .TRUE. or .FALSE. The corresponding C argument is an int, and the MPI spec says that it must return 1 or 0. However, in Fortran, .TRUE. is not always necessarily == 1. So we need to expand the test to see if it's a Fortran callback. If so, check for the Fortran .TRUE. value (not 1). If it's a C callback, then check for 1. This commit was SVN r25965. --- ompi/attribute/attribute.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/ompi/attribute/attribute.c b/ompi/attribute/attribute.c index 67f321e133..c2365546eb 100644 --- a/ompi/attribute/attribute.c +++ b/ompi/attribute/attribute.c @@ -946,19 +946,21 @@ int ompi_attr_copy_all(ompi_attribute_type_t type, void *old_object, so that no comparison is done for prdefined at all and it just falls off the error checking loop in attr_set */ - if (1 == flag) { - if (0 != (hash_value->attr_flag & OMPI_KEYVAL_F77)) { - if (0 != (hash_value->attr_flag & OMPI_KEYVAL_F77_MPI1)) { - new_attr->av_set_from = OMPI_ATTRIBUTE_FORTRAN_MPI1; - } else { - new_attr->av_set_from = OMPI_ATTRIBUTE_FORTRAN_MPI2; - } + if (0 != (hash_value->attr_flag & OMPI_KEYVAL_F77) && + OMPI_FORTRAN_VALUE_TRUE == flag) { + if (0 != (hash_value->attr_flag & OMPI_KEYVAL_F77_MPI1)) { + new_attr->av_set_from = OMPI_ATTRIBUTE_FORTRAN_MPI1; } else { - new_attr->av_set_from = OMPI_ATTRIBUTE_C; + new_attr->av_set_from = OMPI_ATTRIBUTE_FORTRAN_MPI2; } + flag = 1; + } else if (1 == flag) { + new_attr->av_set_from = OMPI_ATTRIBUTE_C; + } + + if (1 == flag) { set_value(type, new_object, &newattr_hash, key, new_attr, true); - } else { OBJ_RELEASE(new_attr); }