Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: Re: [OMPI devel] [OMPI svn-full] svn:open-mpi r20926
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2009-04-01 16:29:59


Ah -- good catch. Thanks.

Should the same fixes be applied to type_create_keyval_f.c and
win_create_keyval_f.c?

On Apr 1, 2009, at 3:31 PM, <igb_at_[hidden]> wrote:

> Author: igb
> Date: 2009-04-01 15:31:46 EDT (Wed, 01 Apr 2009)
> New Revision: 20926
> URL: https://svn.open-mpi.org/trac/ompi/changeset/20926
>
> Log:
> Fix Fortran bindings for MPI_KEYVAL_CREATE and MPI_COMM_CREATE_KEYVAL.
>
> The EXTRA_STATE parameter is passed by reference, and thus should be
> dereferenced before it is stored. Similarly, the stored value should
> be passed by reference to the copy and delete routines.
>
> This fixes #1864.
>
> Text files modified:
> trunk/ompi/attribute/attribute.c | 16 ++++++++++------
> trunk/ompi/mpi/f77/comm_create_keyval_f.c | 2 +-
> trunk/ompi/mpi/f77/keyval_create_f.c | 2 +-
> 3 files changed, 12 insertions(+), 8 deletions(-)
>
> Modified: trunk/ompi/attribute/attribute.c
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- trunk/ompi/attribute/attribute.c (original)
> +++ trunk/ompi/attribute/attribute.c 2009-04-01 15:31:46 EDT
> (Wed, 01 Apr 2009)
> @@ -249,9 +249,10 @@
> /* MPI-1 Fortran-style */ \
> if (0 != (keyval_obj->attr_flag & OMPI_KEYVAL_F77_MPI1)) { \
> MPI_Fint attr_val =
> translate_to_fortran_mpi1(attribute); \
> + MPI_Fint extra_state = (MPI_Fint)keyval_obj-
> >extra_state; \
> (*((keyval_obj-
> >delete_attr_fn).attr_mpi1_fortran_delete_fn)) \
> (&(((ompi_##type##_t *)object)->attr_##type##_f), \
> - &f_key, &attr_val, (int*)keyval_obj->extra_state,
> &f_err); \
> + &f_key, &attr_val, &extra_state, &f_err); \
> if (MPI_SUCCESS != OMPI_FINT_2_INT(f_err)) { \
> if (need_lock) { \
> OPAL_THREAD_UNLOCK(&alock); \
> @@ -262,9 +263,10 @@
> /* MPI-2 Fortran-style */ \
> else { \
> MPI_Aint attr_val =
> translate_to_fortran_mpi2(attribute); \
> + MPI_Aint extra_state = (MPI_Aint)keyval_obj-
> >extra_state; \
> (*((keyval_obj-
> >delete_attr_fn).attr_mpi2_fortran_delete_fn)) \
> (&(((ompi_##type##_t *)object)->attr_##type##_f), \
> - &f_key, (int*)&attr_val, (int*)keyval_obj-
> >extra_state, &f_err); \
> + &f_key, (int*)&attr_val, &extra_state, &f_err); \
> if (MPI_SUCCESS != OMPI_FINT_2_INT(f_err)) { \
> if (need_lock) { \
> OPAL_THREAD_UNLOCK(&alock); \
> @@ -297,11 +299,12 @@
> ompi_fortran_logical_t f_flag; \
> /* MPI-1 Fortran-style */ \
> if (0 != (keyval_obj->attr_flag & OMPI_KEYVAL_F77_MPI1)) { \
> - MPI_Fint in, out; \
> + MPI_Fint in, out,
> extra_state; \
> in = translate_to_fortran_mpi1(in_attr); \
> + extra_state = (MPI_Fint)keyval_obj->extra_state; \
> (*((keyval_obj-
> >copy_attr_fn).attr_mpi1_fortran_copy_fn)) \
> (&(((ompi_##type##_t *)old_object)-
> >attr_##type##_f), \
> - &f_key, (int*)keyval_obj->extra_state, \
> + &f_key, &extra_state, \
> &in, &out, &f_flag, &f_err); \
> if (MPI_SUCCESS != OMPI_FINT_2_INT(f_err)) { \
> OPAL_THREAD_UNLOCK(&alock); \
> @@ -313,11 +316,12 @@
> } \
> /* MPI-2 Fortran-style */ \
> else { \
> - MPI_Aint in, out; \
> + MPI_Aint in, out, extra_state; \
> in = translate_to_fortran_mpi2(in_attr); \
> + extra_state = (MPI_Aint)keyval_obj->extra_state; \
> (*((keyval_obj-
> >copy_attr_fn).attr_mpi2_fortran_copy_fn)) \
> (&(((ompi_##type##_t *)old_object)-
> >attr_##type##_f), \
> - &f_key, keyval_obj->extra_state, &in, &out, \
> + &f_key, &extra_state, &in, &out, \
> &f_flag, &f_err); \
> if (MPI_SUCCESS != OMPI_FINT_2_INT(f_err)) { \
> OPAL_THREAD_UNLOCK(&alock); \
>
> Modified: trunk/ompi/mpi/f77/comm_create_keyval_f.c
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- trunk/ompi/mpi/f77/comm_create_keyval_f.c (original)
> +++ trunk/ompi/mpi/f77/comm_create_keyval_f.c 2009-04-01 15:31:46
> EDT (Wed, 01 Apr 2009)
> @@ -79,7 +79,7 @@
> to the old MPI-1 INTEGER-parameter functions). */
>
> ret = ompi_attr_create_keyval(COMM_ATTR, copy_fn, del_fn,
> - comm_keyval, extra_state,
> OMPI_KEYVAL_F77,
> + comm_keyval, (void*)*extra_state,
> OMPI_KEYVAL_F77,
> NULL);
>
> if (MPI_SUCCESS != ret) {
>
> Modified: trunk/ompi/mpi/f77/keyval_create_f.c
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- trunk/ompi/mpi/f77/keyval_create_f.c (original)
> +++ trunk/ompi/mpi/f77/keyval_create_f.c 2009-04-01 15:31:46
> EDT (Wed, 01 Apr 2009)
> @@ -79,7 +79,7 @@
> functions). */
>
> ret = ompi_attr_create_keyval(COMM_ATTR, copy_fn, del_fn,
> - keyval, extra_state,
> + keyval, (void*)*extra_state,
> OMPI_KEYVAL_F77 |
> OMPI_KEYVAL_F77_MPI1,
> NULL);
>
> _______________________________________________
> svn-full mailing list
> svn-full_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/svn-full

-- 
Jeff Squyres
Cisco Systems