The test case performs an asynchronous host-to-device copy and then immediately clobbers the data on the host via "memset", leading to a race condition. This patch moves the memset after an acc_wait call instead.
Tested with offloading to AMD GCN. I can probably self-approve this as a testcase change only, unless anyone objects. Thanks, Julian 2021-06-29 Julian Brown <jul...@codesourcery.com> libgomp/ * testsuite/libgomp.oacc-c-c++-common/lib-94.c: Fix race condition. --- libgomp/testsuite/libgomp.oacc-c-c++-common/lib-94.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-94.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-94.c index 54497237b0c..baa3ac83f04 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-94.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-94.c @@ -22,10 +22,10 @@ main (int argc, char **argv) acc_copyin_async (h, N, async); - memset (h, 0, N); - acc_wait (async); + memset (h, 0, N); + acc_copyout_async (h, N, async + 1); acc_wait (async + 1); -- 2.29.2