b4fb9f4f9a
This patch adds support for list items in the has_device_addr clause which type is given by C++ template parameters. gcc/cp/ChangeLog: * pt.cc (tsubst_omp_clauses): Added OMP_CLAUSE_HAS_DEVICE_ADDR. * semantics.cc (finish_omp_clauses): Added template decl processing. libgomp/ChangeLog: * testsuite/libgomp.c++/target-has-device-addr-7.C: New test. * testsuite/libgomp.c++/target-has-device-addr-8.C: New test. * testsuite/libgomp.c++/target-has-device-addr-9.C: New test.
37 lines
588 B
C
37 lines
588 B
C
/* Testing 'has_device_addr' clause on the target construct with template. */
|
|
|
|
template <typename T>
|
|
void
|
|
foo (T x)
|
|
{
|
|
x = 24;
|
|
#pragma omp target data map(x) use_device_addr(x)
|
|
#pragma omp target has_device_addr(x)
|
|
x = 42;
|
|
|
|
if (x != 42)
|
|
__builtin_abort ();
|
|
}
|
|
|
|
template <typename T>
|
|
void
|
|
bar (T (&x)[])
|
|
{
|
|
x[0] = 24;
|
|
#pragma omp target data map(x[:2]) use_device_addr(x)
|
|
#pragma omp target has_device_addr(x[:2])
|
|
x[0] = 42;
|
|
|
|
if (x[0] != 42)
|
|
__builtin_abort ();
|
|
}
|
|
|
|
int
|
|
main ()
|
|
{
|
|
int a[] = { 24, 42};
|
|
foo <int> (42);
|
|
bar <int> (a);
|
|
return 0;
|
|
}
|