]> oss.titaniummirror.com Git - msp430-gcc.git/blobdiff - libgomp/testsuite/libgomp.c/nestedfn-5.c
Imported gcc-4.4.3
[msp430-gcc.git] / libgomp / testsuite / libgomp.c / nestedfn-5.c
diff --git a/libgomp/testsuite/libgomp.c/nestedfn-5.c b/libgomp/testsuite/libgomp.c/nestedfn-5.c
new file mode 100644 (file)
index 0000000..6072b1f
--- /dev/null
@@ -0,0 +1,38 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern void abort (void);
+
+void
+foo (int *j)
+{
+  int i = 5;
+  int bar (void) { return i + 1; }
+#pragma omp sections
+  {
+    #pragma omp section
+      {
+       if (bar () != 6)
+       #pragma omp atomic
+         ++*j;
+      }
+    #pragma omp section
+      {
+       if (bar () != 6)
+       #pragma omp atomic
+         ++*j;
+      }
+  }
+}
+
+int
+main (void)
+{
+  int j = 0;
+#pragma omp parallel num_threads (2)
+  foo (&j);
+  if (j)
+    abort ();
+  return 0;
+}
+