Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > b5e52bbfb4bb11a6cbed452927fba979 > files > 88

gcc-4.1.2-50.el5.src.rpm

2007-12-19  Jakub Jelinek  <jakub@redhat.com>

	PR c++/34513
	* parser.c (cp_parser_omp_parallel): For non-combined parallel
	call cp_parser_statement rather than
	cp_parser_already_scoped_statement.

	* testsuite/libgomp.c/pr34513.c: New test.
	* testsuite/libgomp.c++/pr34513.C: New test.

--- gcc/cp/parser.c	(revision 131058)
+++ gcc/cp/parser.c	(revision 131059)
@@ -20271,7 +20271,7 @@ cp_parser_omp_parallel (cp_parser *parse
   switch (p_kind)
     {
     case PRAGMA_OMP_PARALLEL:
-      cp_parser_already_scoped_statement (parser);
+      cp_parser_statement (parser, NULL_TREE, false);
       par_clause = clauses;
       break;
 
--- libgomp/testsuite/libgomp.c++/pr34513.C	(revision 0)
+++ libgomp/testsuite/libgomp.c++/pr34513.C	(revision 131059)
@@ -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 ();
+}
--- libgomp/testsuite/libgomp.c/pr34513.c	(revision 0)
+++ libgomp/testsuite/libgomp.c/pr34513.c	(revision 131059)
@@ -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;
+}