aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2021-06-08 11:16:41 +0200
committerJakub Jelinek <jakub@redhat.com>2021-06-08 11:18:39 +0200
commit8b4641033ab6901c18f68b98843f1038a9a52e03 (patch)
tree8bd4f883f9c6639d57f4f0c25152f167754adb8b /gcc/tree-inline.c
parentf9da798ba6348feaada80de04bc72cdf0c4a1f70 (diff)
downloadgcc-8b4641033ab6901c18f68b98843f1038a9a52e03.zip
gcc-8b4641033ab6901c18f68b98843f1038a9a52e03.tar.gz
gcc-8b4641033ab6901c18f68b98843f1038a9a52e03.tar.bz2
openmp: Fix ICE on depend(source) clause during cdtor cloning [PR100957]
The depend(source) clause has NULL OMP_CLAUSE_DECL, it has just the depend kind specified and no arguments. So copy_tree_body_r shouldn't check TREE_CODE on it without checking it is non-NULL. 2021-06-08 Jakub Jelinek <jakub@redhat.com> PR c++/100957 * tree-inline.c (copy_tree_body_r): For OMP_CLAUSE_DEPEND don't check TREE_CODE if OMP_CLAUSE_DECL is NULL. * g++.dg/gomp/doacross-2.C: New test.
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 4250fd8..9eb08d2 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1458,7 +1458,8 @@ copy_tree_body_r (tree *tp, int *walk_subtrees, void *data)
|| OMP_CLAUSE_CODE (*tp) == OMP_CLAUSE_DEPEND))
{
tree t = OMP_CLAUSE_DECL (*tp);
- if (TREE_CODE (t) == TREE_LIST
+ if (t
+ && TREE_CODE (t) == TREE_LIST
&& TREE_PURPOSE (t)
&& TREE_CODE (TREE_PURPOSE (t)) == TREE_VEC)
{