re PR c++/34513 (static variable not found for C++ OpenMP)
authorJakub Jelinek <jakub@redhat.com>
Wed, 19 Dec 2007 12:58:32 +0000 (13:58 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 19 Dec 2007 12:58:32 +0000 (13:58 +0100)
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.

From-SVN: r131059

gcc/cp/ChangeLog
gcc/cp/parser.c
libgomp/ChangeLog
libgomp/testsuite/libgomp.c++/pr34513.C [new file with mode: 0644]
libgomp/testsuite/libgomp.c/pr34513.c [new file with mode: 0644]

index c7f0fc488cac3f714405ec1683b221f23438e582..39eb736c5b37c0cb1540b1c7a89732c620555319 100644 (file)
@@ -1,3 +1,10 @@
+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.
+
 2007-12-18  Jason Merrill  <jason@redhat.com>
 
        PR c++/34206
index f3d4ce207e623a5085d89b8b9bac4ae9c96675cf..d59262001086d6de93be3ffbacb96beaa225f8b9 100644 (file)
@@ -20271,7 +20271,7 @@ cp_parser_omp_parallel (cp_parser *parser, cp_token *pragma_tok)
   switch (p_kind)
     {
     case PRAGMA_OMP_PARALLEL:
-      cp_parser_already_scoped_statement (parser);
+      cp_parser_statement (parser, NULL_TREE, false, NULL);
       par_clause = clauses;
       break;
 
index 49b6c5494775bee62a01e086482f9f25ec3e8d60..0ef0abf738690425c51cf90297c13a51fdb958e5 100644 (file)
@@ -1,3 +1,9 @@
+2007-12-19  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/34513
+       * testsuite/libgomp.c/pr34513.c: New test.
+       * testsuite/libgomp.c++/pr34513.C: New test.
+
 2007-12-17  Jack Howarth  <howarth@bromo.med.uc.edu>
 
        PR target/32765
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 ();
+}
diff --git a/libgomp/testsuite/libgomp.c/pr34513.c b/libgomp/testsuite/libgomp.c/pr34513.c
new file mode 100644 (file)
index 0000000..76c7ac1
--- /dev/null
@@ -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;
+}