Skip to content

Commit 5a4adb8

Browse files
committed
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 <hjelmn@lanl.gov>
1 parent c2a02ab commit 5a4adb8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ompi/request/req_wait.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ int ompi_request_default_wait_any(size_t count,
125125
after_sync_wait:
126126
/* recheck the complete status and clean up the sync primitives. Do it backward to
127127
* return the earliest complete request to the user. */
128-
for(i = completed-1; i >= 0; i--) {
128+
for(i = completed-1; (i+1) > 0; i--) {
129129
request = requests[i];
130130

131131
if( request->req_state == OMPI_REQUEST_INACTIVE ) {

0 commit comments

Comments
 (0)