public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: gcc-patches@gcc.gnu.org
Cc: Tobias Burnus <tobias@codesourcery.com>
Subject: [committed] openmp: Fix ICE when splitting invalid depend(source)/depend(sink:vec) [PR106836]
Date: Tue, 6 Sep 2022 09:29:37 +0200	[thread overview]
Message-ID: <Yxb24eMBpVYmGwTL@tucnak> (raw)

Hi!

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.

Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk.

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.

--- gcc/c-family/c-omp.cc.jj	2022-09-03 09:41:34.846006111 +0200
+++ gcc/c-family/c-omp.cc	2022-09-05 15:00:00.386360743 +0200
@@ -1877,6 +1877,12 @@ c_omp_split_clauses (location_t loc, enu
 	case OMP_CLAUSE_DEPEND:
 	  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;
--- gcc/testsuite/c-c++-common/gomp/pr106836.c.jj	2022-09-05 15:09:28.715774353 +0200
+++ gcc/testsuite/c-c++-common/gomp/pr106836.c	2022-09-05 15:08:49.273300853 +0200
@@ -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
+}

	Jakub


                 reply	other threads:[~2022-09-06  7:29 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=Yxb24eMBpVYmGwTL@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=tobias@codesourcery.com \
    /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).