aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite
diff options
context:
space:
mode:
authorCesar Philippidis <cesar@codesourcery.com>2016-06-01 13:37:44 -0700
committerCesar Philippidis <cesar@gcc.gnu.org>2016-06-01 13:37:44 -0700
commit3616a8c52ecaf7980d1bd7a66289a63516c9d8fe (patch)
treed618152a17ef24e0340ec6c83a5f4d306230df4d /libgomp/testsuite
parent880ce6a8a45e0a354142d83ac3807c99182077fe (diff)
downloadgcc-3616a8c52ecaf7980d1bd7a66289a63516c9d8fe.zip
gcc-3616a8c52ecaf7980d1bd7a66289a63516c9d8fe.tar.gz
gcc-3616a8c52ecaf7980d1bd7a66289a63516c9d8fe.tar.bz2
re PR c/70688 (bogus OpenACC data clause errors involving reductions)
PR c/70688 * pr70688.c: New file. From-SVN: r237011
Diffstat (limited to 'libgomp/testsuite')
-rw-r--r--libgomp/testsuite/libgomp.oacc-c-c++-common/pr70688.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/pr70688.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr70688.c
new file mode 100644
index 0000000..f9556e3
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr70688.c
@@ -0,0 +1,27 @@
+/* Verify that reduction variables can appear in data clause. */
+
+#include <assert.h>
+
+const int n = 100;
+
+int
+main ()
+{
+ int s = 0;
+ int array[n];
+
+ for (int i = 0; i < n; i++)
+ array[i] = i+1;
+
+#pragma acc parallel loop num_gangs (10) copy (s) reduction (+:s)
+ for (int i = 0; i < n; i++)
+ s += array[i];
+
+#pragma acc parallel loop num_gangs (10) reduction (+:s) copy (s)
+ for (int i = 0; i < n; i++)
+ s += array[i];
+
+ assert (s == n * (n + 1));
+
+ return 0;
+}