re PR c/67501 (Bad error recovery for invalid OpenMP clauses in C FE)
authorJakub Jelinek <jakub@redhat.com>
Wed, 9 Sep 2015 07:24:48 +0000 (09:24 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 9 Sep 2015 07:24:48 +0000 (09:24 +0200)
PR c/67501
* c-parser.c (c_parser_oacc_all_clauses,
c_parser_omp_all_clauses): Remove invalid clause from
list of clauses even if parser->error is set.

* c-c++-common/gomp/pr67501.c: New test.

From-SVN: r227578

gcc/c/ChangeLog
gcc/c/c-parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/gomp/pr67501.c [new file with mode: 0644]

index 141be369b6d909533f2d0de94f9429d5664a4e6c..d7eeb2da4e4bc175f1342d5b6dd074f14599d58b 100644 (file)
@@ -1,5 +1,10 @@
 2015-09-09  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c/67501
+       * c-parser.c (c_parser_oacc_all_clauses,
+       c_parser_omp_all_clauses): Remove invalid clause from
+       list of clauses even if parser->error is set.
+
        PR c/67500
        * c-parser.c (c_parser_omp_clause_aligned,
        c_parser_omp_clause_safelen, c_parser_omp_clause_simdlen): Fix up
index 6213fd452376d16b2a18107e3d2657de64b6d24d..072f94b89151fe1e1391d3e526063558dc8e7526 100644 (file)
@@ -11752,7 +11752,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask,
 
       first = false;
 
-      if (((mask >> c_kind) & 1) == 0 && !parser->error)
+      if (((mask >> c_kind) & 1) == 0)
        {
          /* Remove the invalid clause(s) from the list to avoid
             confusing the rest of the compiler.  */
@@ -11981,7 +11981,7 @@ c_parser_omp_all_clauses (c_parser *parser, omp_clause_mask mask,
 
       first = false;
 
-      if (((mask >> c_kind) & 1) == 0 && !parser->error)
+      if (((mask >> c_kind) & 1) == 0)
        {
          /* Remove the invalid clause(s) from the list to avoid
             confusing the rest of the compiler.  */
index c1c0b6c01da6c4ed3a604e8fb27a6e80392b0214..996fb61d46c7ee7111612910dcee2def6be65b81 100644 (file)
@@ -1,5 +1,8 @@
 2015-09-09  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c/67501
+       * c-c++-common/gomp/pr67501.c: New test.
+
        PR c/67500
        * gcc.dg/gomp/pr67500.c: New test.
 
diff --git a/gcc/testsuite/c-c++-common/gomp/pr67501.c b/gcc/testsuite/c-c++-common/gomp/pr67501.c
new file mode 100644 (file)
index 0000000..8a7140f
--- /dev/null
@@ -0,0 +1,12 @@
+/* PR c/67501 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+void
+foo (void)
+{
+  int i, j;
+  #pragma omp for simd copyprivate(j   /* { dg-error "before end of line" } */
+  for (i = 0; i < 16; ++i)             /* { dg-error "is not valid for" "" { target *-*-* } 9 } */
+    ;
+}