This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] add a test case for PR70688


I had already fixed pr70688 in trunk r236678 with the patch I introduced
here <https://gcc.gnu.org/ml/gcc-patches/2016-05/msg00762.html>. This
patch introduces a new libgomp test case to verify the fix. I'll apply
this patch to trunk and gomp4 as obvious.

Cesar
2016-06-01  Cesar Philippidis  <cesar@codesourcery.com>

	libgomp/
	PR c/70688
	* pr70688.c: New file.


diff --git a/pr70688.c b/pr70688.c
new file mode 100644
index 0000000..9d80577
--- /dev/null
+++ b/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;
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]