libatomic isn't built for amdgcn but reduction-16.c adds it via -foffload=-latomic when offloading for nvptx is enabled. The following avoids linker errors when offloading to amdgcn is enabled as well.
Tested on x86_64-unknown-linux-gnu, OK for trunk and GCC 11 branch? Thanks. Richard. 2021-04-21 Richard Biener <rguent...@suse.de> libgomp/ * testsuite/libgomp.c-c++-common/reduction-16.c: Use -latomic only on nvptx-none. --- libgomp/testsuite/libgomp.c-c++-common/reduction-16.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgomp/testsuite/libgomp.c-c++-common/reduction-16.c b/libgomp/testsuite/libgomp.c-c++-common/reduction-16.c index e60fe3664ed..0eea73b144b 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/reduction-16.c +++ b/libgomp/testsuite/libgomp.c-c++-common/reduction-16.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-additional-options "-foffload=-latomic" { target offload_target_nvptx } } */ +/* { dg-additional-options "-foffload=nvptx-none=-latomic" { target offload_target_nvptx } } */ #include <stdlib.h> -- 2.26.2