aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c/task-5.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgomp/testsuite/libgomp.c/task-5.c')
-rw-r--r--libgomp/testsuite/libgomp.c/task-5.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c/task-5.c b/libgomp/testsuite/libgomp.c/task-5.c
new file mode 100644
index 0000000..b152371
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/task-5.c
@@ -0,0 +1,45 @@
+/* { dg-do run } */
+
+#include <omp.h>
+#include <stdlib.h>
+
+int err;
+
+int
+main ()
+{
+ int e;
+#pragma omp parallel shared(err)
+ {
+ if (omp_in_final ())
+ #pragma omp atomic write
+ err = 1;
+ #pragma omp task if (0) shared(err)
+ {
+ if (omp_in_final ())
+ #pragma omp atomic write
+ err = 1;
+ #pragma omp task if (0) shared(err)
+ if (omp_in_final ())
+ #pragma omp atomic write
+ err = 1;
+ }
+ #pragma omp task final (1) shared(err)
+ {
+ if (!omp_in_final ())
+ #pragma omp atomic write
+ err = 1;
+ #pragma omp taskyield
+ #pragma omp taskwait
+ #pragma omp task shared(err)
+ if (!omp_in_final ())
+ #pragma omp atomic write
+ err = 1;
+ }
+ }
+ #pragma omp atomic read
+ e = err;
+ if (e)
+ abort ();
+ return 0;
+}