Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: Re: [OMPI devel] Bug in MPI_Request_get_status (1.3.1) [PATCH]
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2009-03-27 21:23:25


FWIW, MPI_TEST* and MPI_WAIT* all check for MPI_STATUS[ES]_IGNORE at
the lower layers.

I believe that the correct fix for MPI_REQUEST_GET_STATUS should be
the following, because checks for MPI_STATUS_IGNORE are performed
later in the function:

Index: ompi/mpi/c/request_get_status.c
===================================================================
--- ompi/mpi/c/request_get_status.c (revision 20889)
+++ ompi/mpi/c/request_get_status.c (working copy)
@@ -49,7 +49,7 @@

      if( MPI_PARAM_CHECK ) {
          OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
- if( (NULL == flag) || (NULL == status) ) {
+ if( (NULL == flag) ) {
              return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD,
MPI_ERR_ARG, FUNC_NAME);
          } else if (NULL == request) {
              return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD,
MPI_ERR_REQUEST,

Thanks for the heads-up!

On Mar 27, 2009, at 3:15 PM, Shaun Jackman wrote:

> Hi George,
>
> You will need to update MPI_Test and MPI_Wait as well, which do not
> check that status != NULL. Is there an index of MPI functions by their
> parameter type, such as the set of functions that take an MPI_Status
> argument?
>
> Cheers,
> Shaun
>
> George Bosilca wrote:
> > Shaun,
> >
> > Thanks for the bug report. In general we like to check the arguments
> > against NULL, in order to make sure we don't segfault. However, in
> > this particular context we check against NULL but NULL is our
> > MPI_STATUS_IGNORE. I think I will prefer a little bit more safer
> > solution where we test against NULL just in case we will change the
> > MPI_STATUS_IGNORE value. So instead of the (NULL == status) I will
> > prefer ((NULL == status) && (NULL != MPI_STATUS_IGNORE)). This way
> the
> > compiler can optimize out the second test when MPI_STATUS_IGNORE
> is a
> > NULL constant, and will keep it in case the MPI_STATUS_IGNORE
> became !
> > = NULL.
> >
> > george.
> >
> > On Mar 27, 2009, at 13:39 , Shaun Jackman wrote:
> >
> >> MPI_Request_get_status fails if the status parameter is passed
> >> MPI_STATUS_IGNORE. A patch is attached.
> >>
> >> Cheers,
> >> Shaun
> >>
> >> 2009-03-26 Shaun Jackman <sjackman_at_[hidden]>
> >>
> >> * ompi/mpi/c/request_get_status.c (MPI_Request_get_status):
> >> Do not fail if the status argument is NULL, because the
> >> application may pass MPI_STATUS_IGNORE for the status argument.
> >> 2009-03-26 Shaun Jackman <sjackman_at_[hidden]>
> >>
> >> * ompi/mpi/c/request_get_status.c (MPI_Request_get_status):
> >> Do not fail if the status argument is NULL, because the
> >> application may pass MPI_STATUS_IGNORE for the status
> argument.
> >>
> >> --- ompi/mpi/c/request_get_status.c.orig 2008-11-04
> >> 12:56:27.000000000 -0800
> >> +++ ompi/mpi/c/request_get_status.c 2009-03-26 14:00:00.807344000
> >> -0700
> >> @@ -49,7 +49,7 @@
> >>
> >> if( MPI_PARAM_CHECK ) {
> >> OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
> >> - if( (NULL == flag) || (NULL == status) ) {
> >> + if (NULL == flag) {
> >> return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD,
> >> MPI_ERR_ARG, FUNC_NAME);
> >> } else if (NULL == request) {
> >> return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD,
> >> MPI_ERR_REQUEST,
> >> _______________________________________________
> >> devel mailing list
> >> devel_at_[hidden]
> >> http://www.open-mpi.org/mailman/listinfo.cgi/devel
> >
> > _______________________________________________
> > devel mailing list
> > devel_at_[hidden]
> > http://www.open-mpi.org/mailman/listinfo.cgi/devel
> _______________________________________________
> devel mailing list
> devel_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/devel

-- 
Jeff Squyres
Cisco Systems