From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id 20669383D02F; Tue, 8 Jun 2021 09:18:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 20669383D02F MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-1284] openmp: Fix ICE on depend(source) clause during cdtor cloning [PR100957] X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/master X-Git-Oldrev: f9da798ba6348feaada80de04bc72cdf0c4a1f70 X-Git-Newrev: 8b4641033ab6901c18f68b98843f1038a9a52e03 Message-Id: <20210608091847.20669383D02F@sourceware.org> Date: Tue, 8 Jun 2021 09:18:47 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jun 2021 09:18:47 -0000 https://gcc.gnu.org/g:8b4641033ab6901c18f68b98843f1038a9a52e03 commit r12-1284-g8b4641033ab6901c18f68b98843f1038a9a52e03 Author: Jakub Jelinek Date: Tue Jun 8 11:16:41 2021 +0200 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 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. Diff: --- gcc/testsuite/g++.dg/gomp/doacross-2.C | 16 ++++++++++++++++ gcc/tree-inline.c | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/g++.dg/gomp/doacross-2.C b/gcc/testsuite/g++.dg/gomp/doacross-2.C new file mode 100644 index 00000000000..1fd63570f4a --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/doacross-2.C @@ -0,0 +1,16 @@ +// PR c++/100957 +// { dg-do compile } + +struct S { + S () + { + #pragma omp for ordered(2) + for (int i = 0; i < 32; ++i) + for (int j = 0; j < 32; ++j) + { + #pragma omp ordered depend(source) + ; + #pragma omp ordered depend(sink: i - 1, j - 1) + } + } +}; diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 4250fd86487..9eb08d23320 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) {