Skip to content

Commit 15d5e29

Browse files
authored
Merge pull request #4996 from xinzhao3/topic/shmem-cswap
ompi/oshmem: fix cswap bug in mca/atomic/mxm.
2 parents e87cb25 + a5b72cc commit 15d5e29

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

oshmem/mca/atomic/mxm/atomic_mxm_cswap.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ int mca_atomic_mxm_cswap(void *target,
3434
mxm_send_req_t sreq;
3535

3636
mca_atomic_mxm_req_init(&sreq, pe, target, nlong);
37+
memcpy(prev, value, nlong);
3738

38-
sreq.base.data.buffer.ptr = (void *) value;
39+
sreq.base.data.buffer.ptr = prev;
3940
if (NULL == cond) {
4041
sreq.opcode = MXM_REQ_OP_ATOMIC_SWAP;
4142
} else {
@@ -45,8 +46,6 @@ int mca_atomic_mxm_cswap(void *target,
4546

4647
mca_atomic_mxm_post(&sreq);
4748

48-
memcpy(prev, value, nlong);
49-
5049
return OSHMEM_SUCCESS;
5150
}
5251

0 commit comments

Comments
 (0)