93 lines
1.7 KiB
Diff
93 lines
1.7 KiB
Diff
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;
|
|
+}
|