Projet_SETI_RISC-V/riscv-gnu-toolchain/gcc/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-1.c
2023-03-06 14:48:14 +01:00

24 lines
337 B
C

#include <stdlib.h>
#include <assert.h>
struct dc
{
int a;
int *b;
};
int
main ()
{
int n = 100, i;
struct dc v = { .a = 3, .b = (int *) malloc (sizeof (int) * n) };
#pragma acc parallel loop copy(v.a, v.b[:n])
for (i = 0; i < n; i++)
v.b[i] = v.a;
for (i = 0; i < 10; i++)
assert (v.b[i] == v.a);
return 0;
}