]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
openmp: Fix ICE when splitting invalid depend(source)/depend(sink:vec)
authorJakub Jelinek <jakub@redhat.com>
Tue, 6 Sep 2022 08:16:35 +0000 (10:16 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Tue, 6 Sep 2022 08:16:50 +0000 (10:16 +0200)
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)

gcc/c-family/ChangeLog.omp
gcc/c-family/c-omp.cc
gcc/testsuite/ChangeLog.omp
gcc/testsuite/c-c++-common/gomp/pr106836.c [new file with mode: 0644]

index 9bdb0dbf407b8230ce4fc2c8c7ab4f4cb37666a7..548c302225dac00ce0b0cfc2336a909744e8aa75 100644 (file)
@@ -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:
index 5c45935daca083992876c2862669287b96ae20b0..ab92d60e91aaf7a76e09f1d1e4c6f0eeb6207150 100644 (file)
@@ -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;
index 125f17bac2fa65d0f16cc5cd37fed3fbfd4c9711..58d89825dd03214f1910222b897e43d000526a21 100644 (file)
@@ -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 (file)
index 0000000..6df8250
--- /dev/null
@@ -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
+}