Skip to content

Commit 3d59d84

Browse files
committed
Correct some operations modifying status.MPI_ERROR when it is disallowed
by the standard. Signed-off-by: Aurelien Bouteiller <bouteill@icl.utk.edu> Cleanup Signed-off-by: Aurelien Bouteiller <bouteill@icl.utk.edu>
1 parent 25e0db6 commit 3d59d84

File tree

17 files changed

+92
-102
lines changed

17 files changed

+92
-102
lines changed

ompi/mca/pml/cm/pml_cm.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Copyright (c) 2004-2006 The Regents of the University of California.
33
* All rights reserved.
4-
* Copyright (c) 2004-2007 The University of Tennessee and The University
4+
* Copyright (c) 2004-2021 The University of Tennessee and The University
55
* of Tennessee Research Foundation. All rights
66
* reserved.
77
* Copyright (c) 2015 Research Organization for Information Science
@@ -212,8 +212,8 @@ mca_pml_cm_recv(void *addr,
212212

213213
ompi_request_wait_completion(&req.req_ompi);
214214

215-
if (NULL != status) { /* return status */
216-
*status = req.req_ompi.req_status;
215+
if (MPI_STATUS_IGNORE != status) {
216+
OMPI_COPY_STATUS(status, req.req_ompi.req_status, false);
217217
}
218218
ret = req.req_ompi.req_status.MPI_ERROR;
219219
OBJ_DESTRUCT(&convertor);
@@ -548,8 +548,8 @@ mca_pml_cm_mrecv(void *buf,
548548

549549
ompi_request_wait_completion(&recvreq->req_base.req_ompi);
550550

551-
if (NULL != status) { /* return status */
552-
*status = recvreq->req_base.req_ompi.req_status;
551+
if (MPI_STATUS_IGNORE != status) {
552+
OMPI_COPY_STATUS(status, recvreq->req_base.req_ompi.req_status, false);
553553
}
554554
ret = recvreq->req_base.req_ompi.req_status.MPI_ERROR;
555555
ompi_request_free( (ompi_request_t**)&recvreq );

ompi/mca/pml/ob1/pml_ob1_iprobe.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
33
* University Research and Technology
44
* Corporation. All rights reserved.
5-
* Copyright (c) 2004-2016 The University of Tennessee and The University
5+
* Copyright (c) 2004-2021 The University of Tennessee and The University
66
* of Tennessee Research Foundation. All rights
77
* reserved.
88
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -40,10 +40,10 @@ int mca_pml_ob1_iprobe(int src,
4040
MCA_PML_OB1_RECV_REQUEST_START(&recvreq);
4141

4242
if( REQUEST_COMPLETE( &(recvreq.req_recv.req_base.req_ompi)) ) {
43-
if( NULL != status ) {
44-
*status = recvreq.req_recv.req_base.req_ompi.req_status;
45-
}
4643
rc = recvreq.req_recv.req_base.req_ompi.req_status.MPI_ERROR;
44+
if( MPI_STATUS_IGNORE != status ) {
45+
OMPI_COPY_STATUS(status, recvreq.req_recv.req_base.req_ompi.req_status, false);
46+
}
4747
*matched = 1;
4848
} else {
4949
*matched = 0;
@@ -71,8 +71,8 @@ int mca_pml_ob1_probe(int src,
7171

7272
ompi_request_wait_completion(&recvreq.req_recv.req_base.req_ompi);
7373
rc = recvreq.req_recv.req_base.req_ompi.req_status.MPI_ERROR;
74-
if (NULL != status) {
75-
*status = recvreq.req_recv.req_base.req_ompi.req_status;
74+
if( MPI_STATUS_IGNORE != status ) {
75+
OMPI_COPY_STATUS(status, recvreq.req_recv.req_base.req_ompi.req_status, false);
7676
}
7777

7878
MCA_PML_BASE_RECV_REQUEST_FINI( &recvreq.req_recv );
@@ -107,17 +107,16 @@ mca_pml_ob1_improbe(int src,
107107
MCA_PML_OB1_RECV_REQUEST_START(recvreq);
108108

109109
if( REQUEST_COMPLETE( &(recvreq->req_recv.req_base.req_ompi)) ) {
110-
if( NULL != status ) {
111-
*status = recvreq->req_recv.req_base.req_ompi.req_status;
110+
rc = recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR;
111+
if( MPI_STATUS_IGNORE != status ) {
112+
OMPI_COPY_STATUS(status, recvreq->req_recv.req_base.req_ompi.req_status, false);
112113
}
113114
*matched = 1;
114115

115116
(*message)->comm = comm;
116117
(*message)->req_ptr = recvreq;
117118
(*message)->peer = recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE;
118119
(*message)->count = recvreq->req_recv.req_base.req_ompi.req_status._ucount;
119-
120-
rc = recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR;
121120
} else {
122121
*matched = 0;
123122

@@ -162,9 +161,8 @@ mca_pml_ob1_mprobe(int src,
162161

163162
ompi_request_wait_completion(&recvreq->req_recv.req_base.req_ompi);
164163
rc = recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR;
165-
166-
if( NULL != status ) {
167-
*status = recvreq->req_recv.req_base.req_ompi.req_status;
164+
if( MPI_STATUS_IGNORE != status ) {
165+
OMPI_COPY_STATUS(status, recvreq->req_recv.req_base.req_ompi.req_status, false);
168166
}
169167

170168
if( OMPI_SUCCESS == rc ) {

ompi/mca/pml/ob1/pml_ob1_irecv.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
44
* University Research and Technology
55
* Corporation. All rights reserved.
6-
* Copyright (c) 2004-2016 The University of Tennessee and The University
6+
* Copyright (c) 2004-2021 The University of Tennessee and The University
77
* of Tennessee Research Foundation. All rights
88
* reserved.
99
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -145,8 +145,8 @@ int mca_pml_ob1_recv(void *addr,
145145
);
146146
}
147147

148-
if (NULL != status) { /* return status */
149-
*status = recvreq->req_recv.req_base.req_ompi.req_status;
148+
if (MPI_STATUS_IGNORE != status) {
149+
OMPI_COPY_STATUS(status, recvreq->req_recv.req_base.req_ompi.req_status, false);
150150
}
151151

152152
rc = recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR;
@@ -362,8 +362,8 @@ mca_pml_ob1_mrecv( void *buf,
362362

363363
MCA_PML_OB1_RECV_FRAG_RETURN(frag);
364364

365-
if (NULL != status) { /* return status */
366-
*status = recvreq->req_recv.req_base.req_ompi.req_status;
365+
if (MPI_STATUS_IGNORE != status) {
366+
OMPI_COPY_STATUS(status, recvreq->req_recv.req_base.req_ompi.req_status, false);
367367
}
368368
rc = recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR;
369369
#if OPAL_ENABLE_FT_MPI

ompi/mpi/c/improbe.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*
22
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
3-
* Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
3+
* Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
44
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
55
* Copyright (c) 2015 Research Organization for Information Science
66
* and Technology (RIST). All rights reserved.
7-
* Copyright (c) 2020 The University of Tennessee and The University
7+
* Copyright (c) 2020-2021 The University of Tennessee and The University
88
* of Tennessee Research Foundation. All rights
99
* reserved.
1010
* $COPYRIGHT$
@@ -61,7 +61,7 @@ int MPI_Improbe(int source, int tag, MPI_Comm comm, int *flag,
6161

6262
if (MPI_PROC_NULL == source) {
6363
if (MPI_STATUS_IGNORE != status) {
64-
*status = ompi_request_empty.req_status;
64+
OMPI_COPY_STATUS(status, ompi_request_empty.req_status, false);
6565
/* Per MPI-1, the MPI_ERROR field is not defined for
6666
single-completion calls */
6767
MEMCHECKER(

ompi/mpi/c/iprobe.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
33
* University Research and Technology
44
* Corporation. All rights reserved.
5-
* Copyright (c) 2004-2020 The University of Tennessee and The University
5+
* Copyright (c) 2004-2021 The University of Tennessee and The University
66
* of Tennessee Research Foundation. All rights
77
* reserved.
88
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
@@ -67,7 +67,7 @@ int MPI_Iprobe(int source, int tag, MPI_Comm comm, int *flag, MPI_Status *status
6767
if (MPI_PROC_NULL == source) {
6868
*flag = 1;
6969
if (MPI_STATUS_IGNORE != status) {
70-
*status = ompi_request_empty.req_status;
70+
OMPI_COPY_STATUS(status, ompi_request_empty.req_status, false);
7171
/*
7272
* Per MPI-1, the MPI_ERROR field is not defined for single-completion calls
7373
*/

ompi/mpi/c/mprobe.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
22
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
3-
* Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
3+
* Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
44
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
55
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
66
* Copyright (c) 2015 Research Organization for Information Science
77
* and Technology (RIST). All rights reserved.
8-
* Copyright (c) 2020 The University of Tennessee and The University
8+
* Copyright (c) 2020-2021 The University of Tennessee and The University
99
* of Tennessee Research Foundation. All rights
1010
* reserved.
1111
* $COPYRIGHT$
@@ -62,7 +62,7 @@ int MPI_Mprobe(int source, int tag, MPI_Comm comm,
6262

6363
if (MPI_PROC_NULL == source) {
6464
if (MPI_STATUS_IGNORE != status) {
65-
*status = ompi_request_empty.req_status;
65+
OMPI_COPY_STATUS(status, ompi_request_empty.req_status, false);
6666
/* Per MPI-1, the MPI_ERROR field is not defined for
6767
single-completion calls */
6868
MEMCHECKER(

ompi/mpi/c/mrecv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Copyright (c) 2012-2013 Cisco Systems, Inc. All rights reserved.
55
* Copyright (c) 2015 Research Organization for Information Science
66
* and Technology (RIST). All rights reserved.
7-
* Copyright (c) 2018 The University of Tennessee and The University
7+
* Copyright (c) 2018-2021 The University of Tennessee and The University
88
* of Tennessee Research Foundation. All rights
99
* reserved.
1010
* $COPYRIGHT$
@@ -68,7 +68,7 @@ int MPI_Mrecv(void *buf, int count, MPI_Datatype type,
6868

6969
if (&ompi_message_no_proc.message == *message) {
7070
if (MPI_STATUS_IGNORE != status) {
71-
*status = ompi_request_empty.req_status;
71+
OMPI_COPY_STATUS(status, ompi_request_empty.req_status, false);
7272
}
7373
*message = MPI_MESSAGE_NULL;
7474
return MPI_SUCCESS;

ompi/mpi/c/probe.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
33
* University Research and Technology
44
* Corporation. All rights reserved.
5-
* Copyright (c) 2004-2020 The University of Tennessee and The University
5+
* Copyright (c) 2004-2021 The University of Tennessee and The University
66
* of Tennessee Research Foundation. All rights
77
* reserved.
88
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
@@ -67,7 +67,7 @@ int MPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status *status)
6767

6868
if (MPI_PROC_NULL == source) {
6969
if (MPI_STATUS_IGNORE != status) {
70-
*status = ompi_request_empty.req_status;
70+
OMPI_COPY_STATUS(status, ompi_request_empty.req_status, false);
7171
/*
7272
* Per MPI-1, the MPI_ERROR field is not defined for single-completion calls
7373
*/

ompi/mpi/c/recv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
33
* University Research and Technology
44
* Corporation. All rights reserved.
5-
* Copyright (c) 2004-2020 The University of Tennessee and The University
5+
* Copyright (c) 2004-2021 The University of Tennessee and The University
66
* of Tennessee Research Foundation. All rights
77
* reserved.
88
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
@@ -89,7 +89,7 @@ int MPI_Recv(void *buf, int count, MPI_Datatype type, int source,
8989

9090
if (MPI_PROC_NULL == source) {
9191
if (MPI_STATUS_IGNORE != status) {
92-
*status = ompi_request_empty.req_status;
92+
OMPI_COPY_STATUS(status, ompi_request_empty.req_status, false);
9393
}
9494
return MPI_SUCCESS;
9595
}

ompi/mpi/c/request_get_status.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
33
* University Research and Technology
44
* Corporation. All rights reserved.
5-
* Copyright (c) 2004-2020 The University of Tennessee and The University
5+
* Copyright (c) 2004-2021 The University of Tennessee and The University
66
* of Tennessee Research Foundation. All rights
77
* reserved.
88
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
@@ -70,7 +70,7 @@ int MPI_Request_get_status(MPI_Request request, int *flag,
7070
if( (request == MPI_REQUEST_NULL) || (request->req_state == OMPI_REQUEST_INACTIVE) ) {
7171
*flag = true;
7272
if( MPI_STATUS_IGNORE != status ) {
73-
*status = ompi_status_empty;
73+
OMPI_COPY_STATUS(status, ompi_status_empty, false);
7474
}
7575
return MPI_SUCCESS;
7676
}
@@ -83,7 +83,7 @@ int MPI_Request_get_status(MPI_Request request, int *flag,
8383
ompi_grequest_invoke_query(request, &request->req_status);
8484
}
8585
if (MPI_STATUS_IGNORE != status) {
86-
*status = request->req_status;
86+
OMPI_COPY_STATUS(status, request->req_status, false);
8787
}
8888
return MPI_SUCCESS;
8989
}

0 commit comments

Comments
 (0)