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-12] openmp: Fix ICE when splitting invalid depend(source)/depend(sink:vec)
Date: Wed,  7 Sep 2022 11:01:51 +0000 (GMT)	[thread overview]
Message-ID: <20220907110151.13667385841A@sourceware.org> (raw)

https://gcc.gnu.org/g:2148208cd9f85996dd00abebf33fa53396b099e6

commit 2148208cd9f85996dd00abebf33fa53396b099e6
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Sep 6 10:16:35 2022 +0200

    openmp: Fix ICE when splitting invalid depend(source)/depend(sink:vec)
    
    As we now create OMP_CLAUSE_DOACROSS rather than OMP_CLAUSE_DEPEND when
    depend is used with source/sink modifiers, c_omp_split_clauses can see
    OMP_CLAUSE_DOACROSS clause too before we diagnose it as erroneous.
    
    The following patch treats it like OMP_CLAUSE_DEPEND during
    the splitting but adds an assertion.
    
    2022-09-06  Jakub Jelinek  <jakub@redhat.com>
    
            PR c/106836
            * c-omp.cc (c_omp_split_clauses): Handle OMP_CLAUSE_DOACROSS.
    
            * c-c++-common/gomp/pr106836.c: New test.
    
    (cherry picked from commit 1bf8b7adc2de6f2ddaffa3af131b6855ae3e3793)

Diff:
---
 gcc/c-family/ChangeLog.omp                 | 8 ++++++++
 gcc/c-family/c-omp.cc                      | 6 ++++++
 gcc/testsuite/ChangeLog.omp                | 8 ++++++++
 gcc/testsuite/c-c++-common/gomp/pr106836.c | 9 +++++++++
 4 files changed, 31 insertions(+)

diff --git a/gcc/c-family/ChangeLog.omp b/gcc/c-family/ChangeLog.omp
index 9bdb0dbf407..548c302225d 100644
--- a/gcc/c-family/ChangeLog.omp
+++ b/gcc/c-family/ChangeLog.omp
@@ -1,3 +1,11 @@
+2022-07-06  Tobias Burnus  <tobias@codesourcery.com>
+
+	Backport from mainline:
+	2022-09-06  Jakub Jelinek  <jakub@redhat.com>
+
+	PR c/106836
+	* c-omp.cc (c_omp_split_clauses): Handle OMP_CLAUSE_DOACROSS.
+
 2022-07-05  Tobias Burnus  <tobias@codesourcery.com>
 
 	Backport from mainline:
diff --git a/gcc/c-family/c-omp.cc b/gcc/c-family/c-omp.cc
index 5c45935daca..ab92d60e91a 100644
--- a/gcc/c-family/c-omp.cc
+++ b/gcc/c-family/c-omp.cc
@@ -2023,6 +2023,12 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
 	case OMP_CLAUSE_USES_ALLOCATORS:
 	  s = C_OMP_CLAUSE_SPLIT_TARGET;
 	  break;
+	case OMP_CLAUSE_DOACROSS:
+	  /* This can happen with invalid depend(source) or
+	     depend(sink:vec) on target combined with other constructs.  */
+	  gcc_assert (OMP_CLAUSE_DOACROSS_DEPEND (clauses));
+	  s = C_OMP_CLAUSE_SPLIT_TARGET;
+	  break;
 	case OMP_CLAUSE_NUM_TEAMS:
 	  s = C_OMP_CLAUSE_SPLIT_TEAMS;
 	  break;
diff --git a/gcc/testsuite/ChangeLog.omp b/gcc/testsuite/ChangeLog.omp
index 125f17bac2f..58d89825dd0 100644
--- a/gcc/testsuite/ChangeLog.omp
+++ b/gcc/testsuite/ChangeLog.omp
@@ -1,3 +1,11 @@
+2022-07-06  Tobias Burnus  <tobias@codesourcery.com>
+
+	Backport from mainline:
+	2022-09-06  Jakub Jelinek  <jakub@redhat.com>
+
+	PR c/106836
+	* c-c++-common/gomp/pr106836.c: New test.
+
 2022-09-05  Tobias Burnus  <tobias@codesourcery.com>
 
 	Backport from mainline:
diff --git a/gcc/testsuite/c-c++-common/gomp/pr106836.c b/gcc/testsuite/c-c++-common/gomp/pr106836.c
new file mode 100644
index 00000000000..6df8250f81c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr106836.c
@@ -0,0 +1,9 @@
+/* PR c/106836 */
+
+void
+foo (void)
+{
+#pragma omp target parallel depend (source)	/* { dg-error "'depend\\\(source\\\)' is only allowed in 'omp ordered'" } */
+  ;
+#pragma omp taskwait
+}

                 reply	other threads:[~2022-09-07 11:01 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=20220907110151.13667385841A@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).