+2014-09-18 Jakub Jelinek <jakub@redhat.com>
+
+ 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.
+
2014-09-18 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/62232
case OMP_SECTIONS:
case OMP_SINGLE:
case OMP_TEAMS:
- case OMP_TARGET_DATA:
- case OMP_TARGET:
tmp = tsubst_omp_clauses (OMP_CLAUSES (t), false,
args, complain, in_decl);
stmt = push_stmt_list ();
add_stmt (t);
break;
+ case OMP_TARGET_DATA:
+ case OMP_TARGET:
+ tmp = tsubst_omp_clauses (OMP_CLAUSES (t), false,
+ args, complain, in_decl);
+ keep_next_level (true);
+ stmt = begin_omp_structured_block ();
+
+ RECUR (OMP_BODY (t));
+ stmt = finish_omp_structured_block (stmt);
+
+ t = copy_node (t);
+ OMP_BODY (t) = stmt;
+ OMP_CLAUSES (t) = tmp;
+ add_stmt (t);
+ break;
+
case OMP_TARGET_UPDATE:
tmp = tsubst_omp_clauses (OMP_TARGET_UPDATE_CLAUSES (t), false,
args, complain, in_decl);
else
{
t = OMP_CLAUSE_DECL (c);
- if (!cp_omp_mappable_type (TREE_TYPE (t)))
+ if (TREE_CODE (t) != TREE_LIST
+ && !type_dependent_expression_p (t)
+ && !cp_omp_mappable_type (TREE_TYPE (t)))
{
error_at (OMP_CLAUSE_LOCATION (c),
"array section does not have mappable type "
remove = true;
else if (!(OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
&& OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_POINTER)
+ && !type_dependent_expression_p (t)
&& !cp_omp_mappable_type ((TREE_CODE (TREE_TYPE (t))
== REFERENCE_TYPE)
? TREE_TYPE (TREE_TYPE (t))
+2014-09-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/63248
+ * testsuite/libgomp.c++/pr63248.C: New test.
+
2014-08-04 Jakub Jelinek <jakub@redhat.com>
* task.c (GOMP_taskgroup_end): If taskgroup->num_children
--- /dev/null
+// 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 ();
+}