aboutsummaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-05-27 23:31:40 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2019-05-27 23:31:40 +0200
commit36c7a3fff99326a1dd45f495ee8e1b6bfd6cf9f5 (patch)
tree38f0b99df61879faaca9017c663f679c6d32a82f /libgomp
parentfcfb80325f3ef08b0ee07edc42eef15298ba80ec (diff)
downloadgcc-36c7a3fff99326a1dd45f495ee8e1b6bfd6cf9f5.zip
gcc-36c7a3fff99326a1dd45f495ee8e1b6bfd6cf9f5.tar.gz
gcc-36c7a3fff99326a1dd45f495ee8e1b6bfd6cf9f5.tar.bz2
omp-low.c (lower_omp_1): Look through ordered...
* omp-low.c (lower_omp_1) <case GIMPLE_ASSIGN>: Look through ordered, critical, taskgroup and section regions when looking for a region with non-NULL lastprivate_conditional_map. * testsuite/libgomp.c-c++-common/lastprivate-conditional-3.c: New test. From-SVN: r271672
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog2
-rw-r--r--libgomp/testsuite/libgomp.c-c++-common/lastprivate-conditional-3.c57
2 files changed, 59 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 73bc23e..33906ed 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,5 +1,7 @@
2019-05-27 Jakub Jelinek <jakub@redhat.com>
+ * testsuite/libgomp.c-c++-common/lastprivate-conditional-3.c: New test.
+
PR libgomp/90641
* work.c (gomp_init_work_share): Instead of aligning final ordered
value to multiples of long long alignment, align to that the
diff --git a/libgomp/testsuite/libgomp.c-c++-common/lastprivate-conditional-3.c b/libgomp/testsuite/libgomp.c-c++-common/lastprivate-conditional-3.c
new file mode 100644
index 0000000..6c4370a
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/lastprivate-conditional-3.c
@@ -0,0 +1,57 @@
+/* { dg-do run } */
+/* { dg-require-effective-target tls_runtime } */
+/* { dg-additional-options "-std=gnu99" {target c } } */
+
+#include <omp.h>
+#include <stdlib.h>
+
+int r, s, u, v, t;
+int *x;
+
+void
+foo (int *a)
+{
+ int i;
+ long long j;
+ #pragma omp for lastprivate (conditional: u, x) ordered
+ for (i = 15; i < 64; i++)
+ {
+ #pragma omp critical
+ {
+ if ((a[i] % 5) == 3)
+ u = i;
+ }
+ #pragma omp ordered
+ {
+ if ((a[i] % 7) == 2)
+ x = &a[i];
+ }
+ }
+ #pragma omp for lastprivate (conditional: v) reduction (+:r, s) schedule (nonmonotonic: static) reduction (task, +: t)
+ for (i = -3; i < 119; i += 2)
+ {
+ ++s;
+ #pragma omp taskgroup
+ {
+ #pragma omp task in_reduction (+: t)
+ ++t;
+ if ((a[i + 4] % 11) == 9)
+ v = i;
+ else
+ ++r;
+ }
+ }
+}
+
+int
+main ()
+{
+ int a[128], i;
+ for (i = 0; i < 128; i++)
+ a[i] = i;
+ #pragma omp parallel
+ foo (a);
+ if (u != 63 || v != 115 || x != &a[58] || r != 55 || s != 61 || t != 61)
+ abort ();
+ return 0;
+}