diff libgomp/testsuite/libgomp.c/pr34513.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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgomp/testsuite/libgomp.c/pr34513.c	Fri Jul 17 14:47:48 2009 +0900
@@ -0,0 +1,33 @@
+/* PR c++/34513 */
+/* { dg-do run } */
+
+#include <omp.h>
+
+extern void abort ();
+
+static int errors = 0;
+static int thrs = 4;
+
+int
+main ()
+{
+  omp_set_dynamic (0);
+
+  #pragma omp parallel num_threads (thrs)
+  {
+    static int shrd = 0;
+
+    #pragma omp atomic
+      shrd += 1;
+
+    #pragma omp barrier
+
+    if (shrd != thrs)
+      #pragma omp atomic
+	errors += 1;
+  }
+
+  if (errors)
+    abort ();
+  return 0;
+}