
... to avoid a regression with recent
commit 090f0d78f1
"openmp: Improve expand_omp_atomic_pipeline":
unresolved symbol __atomic_compare_exchange_1
collect2: error: ld returned 1 exit status
mkoffload: fatal error: [...]/gcc/x86_64-pc-linux-gnu-accel-nvptx-none-gcc returned 1 exit status
libgomp/
* testsuite/libgomp.c/target-43.c: '-latomic' for nvptx offloading.
26 lines
476 B
C
26 lines
476 B
C
/* { dg-do run } */
|
|
/* { dg-additional-options "-foffload-options=nvptx-none=-latomic" { target { offload_target_nvptx } } } */
|
|
|
|
#include <stdlib.h>
|
|
|
|
#define N 32
|
|
#define TYPE char
|
|
|
|
int
|
|
main (void)
|
|
{
|
|
TYPE result = 1;
|
|
TYPE a[N];
|
|
for (int x = 0; x < N; ++x)
|
|
a[x] = 1;
|
|
|
|
#pragma omp target map(tofrom: result) map(to:a)
|
|
#pragma omp for simd reduction(&&:result)
|
|
for (int x = 0; x < N; ++x)
|
|
result = result && a[x];
|
|
|
|
if (result != 1)
|
|
abort ();
|
|
|
|
return 0;
|
|
}
|