From: Arnaud Giersch Date: Wed, 6 Mar 2013 12:18:39 +0000 (+0100) Subject: Check return code, and report errors. X-Git-Tag: v3_9_90~470 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/8f3f2a19b6b88f3f810ae59aa54920df7ddff7f2?hp=fd03c86d3c4b115f130d4347f78db5849223e1f6 Check return code, and report errors. Avoids to call MPI_Get_count with an invalid status. --- diff --git a/teshsuite/smpi/mpich-test/pt2pt/sndrcvrep.c b/teshsuite/smpi/mpich-test/pt2pt/sndrcvrep.c index 87b599935d..b4955aa24f 100644 --- a/teshsuite/smpi/mpich-test/pt2pt/sndrcvrep.c +++ b/teshsuite/smpi/mpich-test/pt2pt/sndrcvrep.c @@ -50,12 +50,17 @@ int main( int argc, char **argv ) count = 0; sendtag = 1; recvtag = 1; - MPI_Sendrecv_replace( buf, count, dtype, dest, - sendtag, source, recvtag, MPI_COMM_WORLD, &status ); - MPI_Get_count( &status, dtype, &len ); - if (len != 0) { - errcnt ++; - fprintf( stderr, "Computed %d for count, should be %d\n", len, 0 ); + rc = MPI_Sendrecv_replace( buf, count, dtype, dest, + sendtag, source, recvtag, MPI_COMM_WORLD, &status ); + if (rc) { + errcnt++; + fprintf( stderr, "Failed with non-contiguous datatype (error = %d)\n", rc); + } else { + MPI_Get_count( &status, dtype, &len ); + if (len != 0) { + errcnt ++; + fprintf( stderr, "Computed %d for count, should be %d\n", len, 0 ); + } } MPI_Type_free( &dtype );