From 3f54b3aa219f110121bb75de9209c94f3d1022bd Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Mon, 15 Apr 2013 15:11:15 +0200 Subject: [PATCH] Return early on error. Avoid to use X and Y when they may be uninitialized. --- src/smpi/colls/allgather-2dmesh.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/smpi/colls/allgather-2dmesh.c b/src/smpi/colls/allgather-2dmesh.c index b5f50420e0..4e3a9c77cf 100644 --- a/src/smpi/colls/allgather-2dmesh.c +++ b/src/smpi/colls/allgather-2dmesh.c @@ -119,7 +119,9 @@ smpi_coll_tuned_allgather_2dmesh(void *send_buff, int send_count, MPI_Datatype block_size = extent * send_count; - is_2dmesh(num_procs, &X, &Y); + if (!is_2dmesh(num_procs, &X, &Y)) + return MPI_ERR_COMM; + my_row_base = (rank / Y) * Y; my_col_base = rank % Y; -- 2.20.1