Re: [mpich-devel] Issue with MPI_Error_string() for user-defined codes/clases
On 04/22/2014 04:04 AM, Lisandro Dalcin wrote:
The following simple tests segfaults. A quick fix would be to return an empty string in MPIR_Err_get_dynerr_string() (file dynerrutil.c),
I don't muck around in this code very often, so after thinking about it for a bit, and coming up with another way to do it, I opened a ticket so i could get a second (third, I guess) opinion: https://trac.mpich.org/projects/mpich/ticket/2067 ==rob
e.g:
diff --git a/src/mpi/errhan/dynerrutil.c b/src/mpi/errhan/dynerrutil.c index 943e8c3..fb40469 100644 --- a/src/mpi/errhan/dynerrutil.c +++ b/src/mpi/errhan/dynerrutil.c @@ -297,11 +297,13 @@ const char *MPIR_Err_get_dynerr_string( int code ) if (errcode) { if (errcode < first_free_code) { errstr = user_code_msgs[errcode]; + if (!errstr) errstr = ""; } } else { if (errclass < first_free_class) { errstr = user_class_msgs[errclass]; + if (!errstr) errstr = ""; } }
[dalcinl@kw2060 ~]$ cat error_string2.c #include <stdio.h> #include <mpi.h> int main(int argc, char *argv[]) { int errorclass; char errorstring[MPI_MAX_ERROR_STRING] = {64,0}; int slen; MPI_Init(&argc, &argv); MPI_Add_error_class(&errorclass); MPI_Error_string(errorclass, errorstring, &slen); printf("errorclass:%d errorstring:'%s' len:%d\n", errorclass, errorstring, slen); MPI_Finalize(); return 0; }
-- Rob Latham Mathematics and Computer Science Division Argonne National Lab, IL USA
participants (1)
-
Rob Latham