bce16b887f
PR c++/63248 * semantics.c (finish_omp_clauses): Don't call cp_omp_mappable_type on type of type dependent expressions, and don't call it if handle_omp_array_sections has kept TREE_LIST because something was type dependent. * pt.c (tsubst_expr) <case OMP_TARGET, case OMP_TARGET_DATA>: Use keep_next_level, begin_omp_structured_block and finish_omp_structured_block instead of push_stmt_list and pop_stmt_list. libgomp/ * testsuite/libgomp.c++/pr63248.C: New test. From-SVN: r215359
63 lines
763 B
C
63 lines
763 B
C
// PR c++/63248
|
|
// { dg-do run }
|
|
|
|
int *v;
|
|
|
|
template <typename T>
|
|
T
|
|
foo (T A, T B)
|
|
{
|
|
T a = 2;
|
|
T b = 4;
|
|
|
|
#pragma omp target map(v[a:b])
|
|
v[a] = 1;
|
|
|
|
#pragma omp target map(v[A:B])
|
|
v[a] = 2;
|
|
|
|
#pragma omp target map(A)
|
|
A = 19;
|
|
return A;
|
|
}
|
|
|
|
template <int N>
|
|
int
|
|
bar (int A, int B)
|
|
{
|
|
#pragma omp target map(A)
|
|
A = 8;
|
|
if (A != 8)
|
|
__builtin_abort ();
|
|
#pragma omp target map(A, B)
|
|
{
|
|
A = 1;
|
|
B = 2;
|
|
}
|
|
return A + B;
|
|
}
|
|
|
|
int
|
|
baz (int A, int B)
|
|
{
|
|
#pragma omp target map(A)
|
|
A = 8;
|
|
if (A != 8)
|
|
__builtin_abort ();
|
|
#pragma omp target map(A, B)
|
|
{
|
|
A = 1;
|
|
B = 2;
|
|
}
|
|
return A + B;
|
|
}
|
|
|
|
int
|
|
main ()
|
|
{
|
|
int a[10] = { 0 };
|
|
v = a;
|
|
if (foo (1, 5) != 19 || v[2] != 2 || bar<0> (5, 7) != 3 || baz (5, 7) != 3)
|
|
__builtin_abort ();
|
|
}
|