Commit 232b5604 authored by David Goodell's avatar David Goodell
Browse files

[svn-r9647] tt#1591: fix user errhandlers on predef comms

Thanks to Michael Chuvelev @ Intel for reporting the bug and providing a
test case.

No reviewer.
parent 3a0cae6d
......@@ -176,8 +176,9 @@ int MPI_Finalize( void )
if (!in_use) {
MPIU_Handle_obj_free( &MPID_Errhandler_mem,
MPIR_Process.comm_world->errhandler );
MPIR_Process.comm_world->errhandler = NULL;
}
/* always set to NULL to avoid a double-release later in finalize */
MPIR_Process.comm_world->errhandler = NULL;
}
if (MPIR_Process.comm_self->errhandler &&
! (HANDLE_GET_KIND(MPIR_Process.comm_self->errhandler->handle) ==
......@@ -188,8 +189,9 @@ int MPI_Finalize( void )
if (!in_use) {
MPIU_Handle_obj_free( &MPID_Errhandler_mem,
MPIR_Process.comm_self->errhandler );
MPIR_Process.comm_self->errhandler = NULL;
}
/* always set to NULL to avoid a double-release later in finalize */
MPIR_Process.comm_self->errhandler = NULL;
}
/* FIXME: Why is this not one of the finalize callbacks?. Do we need
......
......@@ -17,7 +17,8 @@ EXTRA_DIST = testlist
noinst_PROGRAMS = \
adderr \
commcall \
errfatal
errfatal \
predef_eh
EXTRA_PROGRAMS = errcode errring errstring
......
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include "mpi.h"
/* Ensure that setting a user-defined error handler on predefined
* communicators does not cause a problem at finalize time. Regression
* test for ticket #1591 */
void errf(MPI_Comm* comm, int* ec)
{
/* do nothing */
}
int main (int argc, char **argv)
{
MPI_Errhandler errh;
MPI_Init (&argc, &argv);
MPI_Comm_create_errhandler((MPI_Comm_errhandler_function*)errf, &errh);
MPI_Comm_set_errhandler(MPI_COMM_WORLD, errh);
MPI_Comm_set_errhandler(MPI_COMM_SELF, errh);
MPI_Finalize();
printf(" No Errors\n");
return 0;
}
adderr 1
commcall 2
errfatal 1 resultTest=TestErrFatal
predef_eh 1
predef_eh 2
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment