public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tobias Burnus <burnus@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/omp/gcc-11] openmp: Fix ICE on depend(source) clause during cdtor cloning [PR100957]
Date: Tue,  8 Jun 2021 09:45:31 +0000 (GMT)	[thread overview]
Message-ID: <20210608094531.79D833844051@sourceware.org> (raw)

https://gcc.gnu.org/g:5df2d7e94451182b6e6497198039701fa9028c8c

commit 5df2d7e94451182b6e6497198039701fa9028c8c
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Jun 8 11:45:02 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  <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.
    
    (cherry picked from commit 8b4641033ab6901c18f68b98843f1038a9a52e03)

Diff:
---
 gcc/ChangeLog.omp                      |  9 +++++++++
 gcc/testsuite/ChangeLog.omp            |  8 ++++++++
 gcc/testsuite/g++.dg/gomp/doacross-2.C | 16 ++++++++++++++++
 gcc/tree-inline.c                      |  3 ++-
 4 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index 25717436651..8bedf3033e9 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,12 @@
+2021-06-08  Tobias Burnus  <tobias@codesourcery.com>
+
+	Backported from master:
+	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.
+
 2021-06-04  Tobias Burnus  <tobias@codesourcery.com>
 
 	Backported from master:
diff --git a/gcc/testsuite/ChangeLog.omp b/gcc/testsuite/ChangeLog.omp
index 5221047c0c9..a0f0bcd94df 100644
--- a/gcc/testsuite/ChangeLog.omp
+++ b/gcc/testsuite/ChangeLog.omp
@@ -1,3 +1,11 @@
+2021-06-08  Tobias Burnus  <tobias@codesourcery.com>
+
+	Backported from master:
+	2021-06-08  Jakub Jelinek  <jakub@redhat.com>
+
+	PR c++/100957
+	* g++.dg/gomp/doacross-2.C: New test.
+
 2021-06-08  Tobias Burnus  <tobias@codesourcery.com>
 
 	Backported from master:
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 78dc64886c4..0f607808801 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1482,7 +1482,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)
 	    {


                 reply	other threads:[~2021-06-08  9:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210608094531.79D833844051@sourceware.org \
    --to=burnus@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).