diff libgomp/testsuite/libgomp.c/omp-single-2.c @ 0:a06113de4d67

first commit
author kent <kent@cr.ie.u-ryukyu.ac.jp>
date Fri, 17 Jul 2009 14:47:48 +0900
parents
children 04ced10e8804
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgomp/testsuite/libgomp.c/omp-single-2.c	Fri Jul 17 14:47:48 2009 +0900
@@ -0,0 +1,38 @@
+#include <omp.h>
+
+extern void abort (void);
+
+struct X
+{
+  int a;
+  char b;
+  int c;
+};
+
+main()
+{
+  int i = 0;
+  struct X x;
+  int bad = 0;
+
+  #pragma omp parallel private (i, x) shared (bad)
+    {
+      i = 5;
+
+      #pragma omp single copyprivate (i, x)
+	{
+	  i++;
+	  x.a = 23;
+	  x.b = 42;
+	  x.c = 26;
+	}
+
+      if (i != 6 || x.a != 23 || x.b != 42 || x.c != 26)
+	bad = 1;
+    }
+
+  if (bad)
+    abort ();
+
+  return 0;
+}