@@ -2366,11 +2366,12 @@ mgetput(NC *ncp,
23662366 last_contig_req = 0 ; /* index of the last contiguous request */
23672367 buf = NULL ;
23682368 /* process only valid requests */
2369- for (i = 0 , j = 0 ; i < num_reqs ; i ++ ) {
2369+ for (j = 0 , i = 0 ; i < num_reqs ; i ++ ) {
23702370 MPI_Offset req_size ;
23712371 NC_lead_req * lead = lead_list + reqs [i ].lead_off ;
23722372
2373- if (fIsSet (lead -> flag , NC_REQ_SKIP )) continue ;
2373+ if (fIsSet (lead -> flag , NC_REQ_SKIP ))
2374+ continue ; /* skip invalid request */
23742375
23752376 req_size = reqs [i ].nelems * lead -> varp -> xsz ;
23762377
@@ -2391,6 +2392,9 @@ mgetput(NC *ncp,
23912392 if (j == 0 ) { /* first valid request */
23922393 a_last_contig = a0 = ai ;
23932394 buf = reqs [i ].xbuf ;
2395+ disps [0 ] = 0 ;
2396+ j = 1 ;
2397+ continue ;
23942398 }
23952399 disps [j ] = MPI_Aint_diff (ai , a0 );
23962400
@@ -2405,7 +2409,7 @@ mgetput(NC *ncp,
24052409#else
24062410 /* if req_size overflows 4-byte int, then skip coalescing */
24072411 if (req_size <= NC_MAX_INT &&
2408- MPI_Aint_diff (ai ,- a_last_contig ) == blocklens [last_contig_req ]) {
2412+ MPI_Aint_diff (ai , a_last_contig ) == blocklens [last_contig_req ]) {
24092413 /* user buffer of request j is contiguous from j-1
24102414 * we coalesce j to j-1 */
24112415 blocklens [last_contig_req ] += blocklens [j ];
0 commit comments