]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c/85696 (OpenMP with variably modified and default(none) won't compile)
authorJakub Jelinek <jakub@gcc.gnu.org>
Fri, 22 Jun 2018 21:27:25 +0000 (23:27 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 22 Jun 2018 21:27:25 +0000 (23:27 +0200)
Backported from mainline
2018-05-11  Jakub Jelinek  <jakub@redhat.com>

PR c/85696
* c-omp.c (c_omp_predetermined_sharing): Return
OMP_CLAUSE_DEFAULT_SHARED for artificial vars with integral type.

* c-typeck.c (c_finish_omp_clauses): Don't use
c_omp_predetermined_sharing, instead just check TREE_READONLY.

* cp-tree.h (cxx_omp_predetermined_sharing_1): New prototype.
* cp-gimplify.c (cxx_omp_predetermined_sharing): New wrapper around
cxx_omp_predetermined_sharing_1.  Rename old function to ...
(cxx_omp_predetermined_sharing_1): ... this.
* semantics.c (finish_omp_clauses): Use cxx_omp_predetermined_sharing_1
instead of cxx_omp_predetermined_sharing.

* c-c++-common/gomp/pr85696.c: New test.

From-SVN: r261964

gcc/testsuite/c-c++-common/gomp/pr85696.c [new file with mode: 0644]

diff --git a/gcc/testsuite/c-c++-common/gomp/pr85696.c b/gcc/testsuite/c-c++-common/gomp/pr85696.c
new file mode 100644 (file)
index 0000000..798718b
--- /dev/null
@@ -0,0 +1,20 @@
+/* PR c/85696 */
+
+#ifndef __cplusplus
+void
+foo (int n, int a[][n])
+{
+  #pragma omp parallel shared(a) default(none)
+  #pragma omp master
+    a[23][0] = 42;
+}
+#endif
+
+void
+bar (int n, void *p)
+{
+  int (*a)[n] = (int (*)[n]) p;
+  #pragma omp parallel shared(a) default(none)
+  #pragma omp master
+    a[23][0] = 42;
+}