diff options
author | Jakub Jelinek <jakub@redhat.com> | 2014-09-18 18:43:28 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2014-09-18 18:43:28 +0200 |
commit | bce16b887fcdc5db5e00ffaae92b4e4b5c0fdeca (patch) | |
tree | 29355c71634ce536e2f8aaf0e6ebc5adb9ec9423 /libgomp/testsuite | |
parent | 74c101d5fd4ebf45d9127efd82e1325882e48a12 (diff) | |
download | gcc-bce16b887fcdc5db5e00ffaae92b4e4b5c0fdeca.zip gcc-bce16b887fcdc5db5e00ffaae92b4e4b5c0fdeca.tar.gz gcc-bce16b887fcdc5db5e00ffaae92b4e4b5c0fdeca.tar.bz2 |
re PR c++/63248 (Crash when OpenMP target's array section handling is used with templates)
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
Diffstat (limited to 'libgomp/testsuite')
-rw-r--r-- | libgomp/testsuite/libgomp.c++/pr63248.C | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c++/pr63248.C b/libgomp/testsuite/libgomp.c++/pr63248.C new file mode 100644 index 0000000..48d3f0a --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/pr63248.C @@ -0,0 +1,62 @@ +// 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 (); +} |