summaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c++/loop-2.C
diff options
context:
space:
mode:
Diffstat (limited to 'libgomp/testsuite/libgomp.c++/loop-2.C')
-rw-r--r--libgomp/testsuite/libgomp.c++/loop-2.C32
1 files changed, 32 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c++/loop-2.C b/libgomp/testsuite/libgomp.c++/loop-2.C
new file mode 100644
index 000000000..ea3dc588a
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/loop-2.C
@@ -0,0 +1,32 @@
+#include <omp.h>
+
+/* Orphaned work sharing. */
+
+extern "C" void abort (void);
+
+#define N 10
+
+void parloop (int *a)
+{
+ int i;
+
+#pragma omp for
+ for (i = 0; i < N; i++)
+ a[i] = i + 3;
+}
+
+main()
+{
+ int i, a[N];
+
+#pragma omp parallel shared(a)
+ {
+ parloop (a);
+ }
+
+ for (i = 0; i < N; i++)
+ if (a[i] != i + 3)
+ abort ();
+
+ return 0;
+}