From 0bb99c1162085f10cb1706f61774e72b654e5279 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 9 Sep 2015 09:24:48 +0200 Subject: [PATCH] re PR c/67501 (Bad error recovery for invalid OpenMP clauses in C FE) 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 | 5 +++++ gcc/c/c-parser.c | 4 ++-- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/c-c++-common/gomp/pr67501.c | 12 ++++++++++++ 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/gomp/pr67501.c diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 141be369b6d..d7eeb2da4e4 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,5 +1,10 @@ 2015-09-09 Jakub Jelinek + 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 diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 6213fd45237..072f94b8915 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -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. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c1c0b6c01da..996fb61d46c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2015-09-09 Jakub Jelinek + 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 index 00000000000..8a7140faf28 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr67501.c @@ -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 } */ + ; +} -- 2.30.2