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: George Bosilca (bosilca_at_[hidden])
Date: 2009-03-27 14:24:30


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