summaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c/loop-9.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgomp/testsuite/libgomp.c/loop-9.c')
-rw-r--r--libgomp/testsuite/libgomp.c/loop-9.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c/loop-9.c b/libgomp/testsuite/libgomp.c/loop-9.c
new file mode 100644
index 000000000..1f789e12e
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/loop-9.c
@@ -0,0 +1,18 @@
+extern void abort (void);
+
+char buf[8] = "01234567";
+char buf2[8] = "23456789";
+
+int
+main (void)
+{
+ char *p, *q;
+ int sum = 0;
+ #pragma omp parallel for collapse (2) reduction (+:sum) lastprivate (p, q)
+ for (p = buf; p < &buf[8]; p++)
+ for (q = &buf2[0]; q <= buf2 + 7; q++)
+ sum += (*p - '0') + (*q - '0');
+ if (p != &buf[8] || q != buf2 + 8 || sum != 576)
+ abort ();
+ return 0;
+}