]> oss.titaniummirror.com Git - msp430-gcc.git/blobdiff - libgomp/testsuite/libgomp.c++/pr34513.C
Imported gcc-4.4.3
[msp430-gcc.git] / libgomp / testsuite / libgomp.c++ / pr34513.C
diff --git a/libgomp/testsuite/libgomp.c++/pr34513.C b/libgomp/testsuite/libgomp.c++/pr34513.C
new file mode 100644 (file)
index 0000000..e5ad3bc
--- /dev/null
@@ -0,0 +1,32 @@
+// PR c++/34513
+// { dg-do run }
+
+#include <omp.h>
+
+extern "C" 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 ();
+}