aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c++/depend-1.C
diff options
context:
space:
mode:
Diffstat (limited to 'libgomp/testsuite/libgomp.c++/depend-1.C')
-rw-r--r--libgomp/testsuite/libgomp.c++/depend-1.C31
1 files changed, 31 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c++/depend-1.C b/libgomp/testsuite/libgomp.c++/depend-1.C
new file mode 100644
index 0000000..71a24d1
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/depend-1.C
@@ -0,0 +1,31 @@
+extern "C" void abort ();
+int a, b, c, d, e;
+
+void
+foo (int &x, bool y)
+{
+ #pragma omp task depend (out: x)
+ a = 1;
+ #pragma omp task depend (out: y ? b : c)
+ (y ? b : c) = 2;
+ #pragma omp task depend (inout: --d)
+ d += 4;
+ #pragma omp task depend (in : a, (y ? b : c), d)
+ e = a + b * 10 + c * 100 + d * 1000;
+}
+
+int
+main ()
+{
+ #pragma omp parallel
+ #pragma omp single
+ foo (a, true);
+ if (e != 1 + 20 + 0 + 3000)
+ abort ();
+ a = b = c = d = e = 0;
+ #pragma omp parallel
+ #pragma omp single
+ foo (a, false);
+ if (e != 1 + 0 + 200 + 3000)
+ abort ();
+}