aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c-c++-common
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-12-02 13:48:42 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2018-12-02 13:48:42 +0100
commitdaa8c1d763c951d2242e1842be80b179f63ebad2 (patch)
tree2e3655327f79bb903789d11133c2be9edf5b3baa /libgomp/testsuite/libgomp.c-c++-common
parente80944753d325ef009acf58a5b3188936997d22b (diff)
downloadgcc-daa8c1d763c951d2242e1842be80b179f63ebad2.zip
gcc-daa8c1d763c951d2242e1842be80b179f63ebad2.tar.gz
gcc-daa8c1d763c951d2242e1842be80b179f63ebad2.tar.bz2
omp-low.c (check_omp_nesting_restrictions): Allow cancel or cancellation point with taskgroup clause inside of taskloop.
* omp-low.c (check_omp_nesting_restrictions): Allow cancel or cancellation point with taskgroup clause inside of taskloop. Consider a taskloop construct without nogroup clause as implicit taskgroup for diagnostics if cancel/cancellation point with taskgroup clause is closely nested inside of taskgroup region. * c-c++-common/gomp/cancel-1.c (f2): Add various taskloop related tests. * testsuite/libgomp.c-c++-common/cancel-taskgroup-4.c: New test. From-SVN: r266722
Diffstat (limited to 'libgomp/testsuite/libgomp.c-c++-common')
-rw-r--r--libgomp/testsuite/libgomp.c-c++-common/cancel-taskgroup-4.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c-c++-common/cancel-taskgroup-4.c b/libgomp/testsuite/libgomp.c-c++-common/cancel-taskgroup-4.c
new file mode 100644
index 0000000..341bfb8
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/cancel-taskgroup-4.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+/* { dg-set-target-env-var OMP_CANCELLATION "true" } */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <omp.h>
+
+int
+main ()
+{
+ int i;
+ #pragma omp parallel
+ {
+ int c = 0;
+ #pragma omp barrier
+ #pragma omp master taskloop num_tasks (25) firstprivate (c)
+ for (i = 0; i < 50; i++)
+ {
+ if (c && omp_get_cancellation ())
+ abort ();
+ #pragma omp cancellation point taskgroup
+ usleep (30);
+ if (i > 10)
+ c = 1;
+ #pragma omp cancel taskgroup if (i > 10)
+ if (i > 10 && omp_get_cancellation ())
+ abort ();
+ }
+ usleep (10);
+ }
+ return 0;
+}