gcc/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-2.c
Julian Brown c2eb021fd2 OpenACC 2.6 deep copy: C and C++ execution tests
libgomp/
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-1.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-2.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-4.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-6.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-7.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-9.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-10.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-11.c: New test.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-14.c: New test.
	* testsuite/libgomp.oacc-c++/deep-copy-12.C: New test.
	* testsuite/libgomp.oacc-c++/deep-copy-13.C: New test.

From-SVN: r279629
2019-12-20 01:39:42 +00:00

30 lines
507 B
C

#include <assert.h>
#include <stdlib.h>
int
main(int argc, char* argv[])
{
struct foo {
int *a, *b, c, d, *e;
} s;
s.a = (int *) malloc (16 * sizeof (int));
s.b = (int *) malloc (16 * sizeof (int));
s.e = (int *) malloc (16 * sizeof (int));
#pragma acc data copy(s)
{
#pragma acc data copy(s.a[0:10])
{
#pragma acc parallel loop attach(s.a)
for (int i = 0; i < 10; i++)
s.a[i] = i;
}
}
for (int i = 0; i < 10; i++)
assert (s.a[i] == i);
return 0;
}