diff mbox

add a test case for PR70688

Message ID 574F45D8.8030609@codesourcery.com
State New
Headers show

Commit Message

Cesar Philippidis June 1, 2016, 8:30 p.m. UTC
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
diff mbox

Patch

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;
+}