Skip to content

Commit 01c90d4

Browse files
committed
fortran/mpif-h: fix *_create_keyval_f
correctly handle out parameter *_keyval when OMPI_SIZEOF_FORTRAN_INTEGER > SIZEOF_INT
1 parent 178dde6 commit 01c90d4

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

ompi/mpi/fortran/mpif-h/comm_create_keyval_f.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
1212
* Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
13-
* Copyright (c) 2015 Research Organization for Information Science
13+
* Copyright (c) 2015-2016 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
1515
* $COPYRIGHT$
1616
*
@@ -75,6 +75,7 @@ void ompi_comm_create_keyval_f(ompi_mpi2_fortran_copy_attr_function* comm_copy_a
7575
MPI_Aint *extra_state, MPI_Fint *ierr)
7676
{
7777
int ret, c_ierr;
78+
OMPI_SINGLE_NAME_DECL(comm_keyval);
7879
ompi_attribute_fn_ptr_union_t copy_fn;
7980
ompi_attribute_fn_ptr_union_t del_fn;
8081

@@ -87,7 +88,7 @@ void ompi_comm_create_keyval_f(ompi_mpi2_fortran_copy_attr_function* comm_copy_a
8788
to the old MPI-1 INTEGER-parameter functions). */
8889

8990
ret = ompi_attr_create_keyval_aint(COMM_ATTR, copy_fn, del_fn,
90-
comm_keyval, *extra_state, OMPI_KEYVAL_F77,
91+
OMPI_SINGLE_NAME_CONVERT(comm_keyval), *extra_state, OMPI_KEYVAL_F77,
9192
NULL);
9293

9394
if (MPI_SUCCESS != ret) {
@@ -97,5 +98,6 @@ void ompi_comm_create_keyval_f(ompi_mpi2_fortran_copy_attr_function* comm_copy_a
9798
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
9899
} else {
99100
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(MPI_SUCCESS);
101+
OMPI_SINGLE_INT_2_FINT(comm_keyval);
100102
}
101103
}

ompi/mpi/fortran/mpif-h/keyval_create_f.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
1212
* Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
13-
* Copyright (c) 2015 Research Organization for Information Science
13+
* Copyright (c) 2015-2016 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
1515
* $COPYRIGHT$
1616
*
@@ -74,6 +74,7 @@ void ompi_keyval_create_f(ompi_mpi1_fortran_copy_attr_function* copy_attr_fn,
7474
MPI_Fint *ierr)
7575
{
7676
int ret, c_ierr;
77+
OMPI_SINGLE_NAME_DECL(keyval);
7778
ompi_attribute_fn_ptr_union_t copy_fn;
7879
ompi_attribute_fn_ptr_union_t del_fn;
7980

@@ -86,16 +87,17 @@ void ompi_keyval_create_f(ompi_mpi1_fortran_copy_attr_function* copy_attr_fn,
8687
functions). */
8788

8889
ret = ompi_attr_create_keyval_fint(COMM_ATTR, copy_fn, del_fn,
89-
keyval, *extra_state,
90+
OMPI_SINGLE_NAME_CONVERT(keyval), *extra_state,
9091
OMPI_KEYVAL_F77 | OMPI_KEYVAL_F77_MPI1,
9192
NULL);
9293

9394
if (MPI_SUCCESS != ret) {
9495
c_ierr = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD,
9596
MPI_ERR_OTHER,
9697
FUNC_NAME);
98+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
9799
} else {
98-
c_ierr = MPI_SUCCESS;
100+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(MPI_SUCCESS);
101+
OMPI_SINGLE_INT_2_FINT(keyval);
99102
}
100-
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
101103
}

ompi/mpi/fortran/mpif-h/type_create_keyval_f.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
1212
* Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
13-
* Copyright (c) 2015 Research Organization for Information Science
13+
* Copyright (c) 2015-2016 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
1515
* $COPYRIGHT$
1616
*
@@ -73,6 +73,7 @@ void ompi_type_create_keyval_f(ompi_mpi2_fortran_copy_attr_function* type_copy_a
7373
MPI_Fint *type_keyval, MPI_Aint *extra_state, MPI_Fint *ierr)
7474
{
7575
int ret, c_ierr;
76+
OMPI_SINGLE_NAME_DECL(type_keyval);
7677
ompi_attribute_fn_ptr_union_t copy_fn;
7778
ompi_attribute_fn_ptr_union_t del_fn;
7879

@@ -85,15 +86,16 @@ void ompi_type_create_keyval_f(ompi_mpi2_fortran_copy_attr_function* type_copy_a
8586
to the old MPI-1 INTEGER-parameter functions). */
8687

8788
ret = ompi_attr_create_keyval_aint(TYPE_ATTR, copy_fn, del_fn,
88-
type_keyval, *extra_state, OMPI_KEYVAL_F77,
89+
OMPI_SINGLE_NAME_CONVERT(type_keyval), *extra_state, OMPI_KEYVAL_F77,
8990
NULL);
9091

9192
if (MPI_SUCCESS != ret) {
9293
c_ierr = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD,
9394
MPI_ERR_OTHER,
9495
FUNC_NAME);
96+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
9597
} else {
96-
c_ierr = MPI_SUCCESS;
98+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(MPI_SUCCESS);
99+
OMPI_SINGLE_INT_2_FINT(type_keyval);
97100
}
98-
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
99101
}

ompi/mpi/fortran/mpif-h/win_create_keyval_f.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
1212
* Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
13-
* Copyright (c) 2015 Research Organization for Information Science
13+
* Copyright (c) 2015-2016 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
1515
* $COPYRIGHT$
1616
*
@@ -73,6 +73,7 @@ void ompi_win_create_keyval_f(ompi_mpi2_fortran_copy_attr_function* win_copy_att
7373
MPI_Fint *win_keyval, MPI_Aint *extra_state, MPI_Fint *ierr)
7474
{
7575
int ret, c_ierr;
76+
OMPI_SINGLE_NAME_DECL(win_keyval);
7677
ompi_attribute_fn_ptr_union_t copy_fn;
7778
ompi_attribute_fn_ptr_union_t del_fn;
7879

@@ -85,7 +86,7 @@ void ompi_win_create_keyval_f(ompi_mpi2_fortran_copy_attr_function* win_copy_att
8586
to the old MPI-1 INTEGER-parameter functions). */
8687

8788
ret = ompi_attr_create_keyval_aint(WIN_ATTR, copy_fn, del_fn,
88-
win_keyval, *extra_state, OMPI_KEYVAL_F77,
89+
OMPI_SINGLE_NAME_CONVERT(win_keyval), *extra_state, OMPI_KEYVAL_F77,
8990
NULL);
9091

9192
if (MPI_SUCCESS != ret) {
@@ -94,5 +95,6 @@ void ompi_win_create_keyval_f(ompi_mpi2_fortran_copy_attr_function* win_copy_att
9495
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
9596
} else {
9697
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(MPI_SUCCESS);
98+
OMPI_SINGLE_INT_2_FINT(win_keyval);
9799
}
98100
}

0 commit comments

Comments
 (0)