Skip to content

Commit a8ac31a

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 <[email protected]> (cherry picked from open-mpi/ompi@5a4adb8) Signed-off-by: Nathan Hjelm <[email protected]>
1 parent 4cd665e commit a8ac31a

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
@@ -127,7 +127,7 @@ int ompi_request_default_wait_any(size_t count,
127127
after_sync_wait:
128128
/* recheck the complete status and clean up the sync primitives. Do it backward to
129129
* return the earliest complete request to the user. */
130-
for(i = completed-1; i >= 0; i--) {
130+
for(i = completed-1; (i+1) > 0; i--) {
131131
request = requests[i];
132132

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

0 commit comments

Comments
 (0)