aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2014-09-18 18:43:28 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2014-09-18 18:43:28 +0200
commitbce16b887fcdc5db5e00ffaae92b4e4b5c0fdeca (patch)
tree29355c71634ce536e2f8aaf0e6ebc5adb9ec9423 /gcc
parent74c101d5fd4ebf45d9127efd82e1325882e48a12 (diff)
downloadgcc-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 'gcc')
-rw-r--r--gcc/cp/ChangeLog12
-rw-r--r--gcc/cp/pt.c18
-rw-r--r--gcc/cp/semantics.c5
3 files changed, 32 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3a20e92..e7e0a3c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,15 @@
+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
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index b3a9c95..8a12713 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -14089,8 +14089,6 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl,
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 ();
@@ -14103,6 +14101,22 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl,
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);
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index aee92dd..bcf161b 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -5668,7 +5668,9 @@ finish_omp_clauses (tree clauses)
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 "
@@ -5708,6 +5710,7 @@ finish_omp_clauses (tree clauses)
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))