From 5a4adb866dfc1cd0216cb641d598647779726434 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Tue, 7 Jun 2016 10:28:46 -0600 Subject: [PATCH] ompi/request: fix loop conditional This commit fixes a bug in waitany that causes the code to go past the beginning of the request array. The loop conditional i >= 0 is invalid since i is unsigned. Changed to loop to check (i+1) > 0. Signed-off-by: Nathan Hjelm --- ompi/request/req_wait.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/request/req_wait.c b/ompi/request/req_wait.c index 5e3b6f92ff..d559c3ad6b 100644 --- a/ompi/request/req_wait.c +++ b/ompi/request/req_wait.c @@ -125,7 +125,7 @@ int ompi_request_default_wait_any(size_t count, after_sync_wait: /* recheck the complete status and clean up the sync primitives. Do it backward to * return the earliest complete request to the user. */ - for(i = completed-1; i >= 0; i--) { + for(i = completed-1; (i+1) > 0; i--) { request = requests[i]; if( request->req_state == OMPI_REQUEST_INACTIVE ) {