From 192b048b5c92b3af78af0f58bf4474e5db770f23 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 9 Feb 2017 17:07:26 +0000 Subject: [PATCH] re PR c/79428 (ICE in c_parser_consume_token, at c/c-parser.c:770) PR c/79428 * c-parser.c (c_parser_omp_ordered): Call c_parser_skip_to_pragma_eol instead of c_parser_skip_until_found. * c-c++-common/cilk-plus/CK/pr79428-4.c: New test. * c-c++-common/cilk-plus/CK/pr79428-7.c: New test. * c-c++-common/goacc/pr79428-1.c: New test. * c-c++-common/gomp/pr79428-2.c: New test. * c-c++-common/gomp/pr79428-5.c: New test. * c-c++-common/gomp/pr79428-6.c: New test. * c-c++-common/pr79428-3.c: New test. From-SVN: r245309 --- gcc/c/ChangeLog | 6 ++++++ gcc/c/c-parser.c | 2 +- gcc/testsuite/ChangeLog | 11 +++++++++++ gcc/testsuite/c-c++-common/cilk-plus/CK/pr79428-4.c | 3 +++ gcc/testsuite/c-c++-common/cilk-plus/CK/pr79428-7.c | 3 +++ gcc/testsuite/c-c++-common/goacc/pr79428-1.c | 6 ++++++ gcc/testsuite/c-c++-common/gomp/pr79428-2.c | 7 +++++++ gcc/testsuite/c-c++-common/gomp/pr79428-5.c | 3 +++ gcc/testsuite/c-c++-common/gomp/pr79428-6.c | 3 +++ gcc/testsuite/c-c++-common/pr79428-3.c | 3 +++ 10 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/c-c++-common/cilk-plus/CK/pr79428-4.c create mode 100644 gcc/testsuite/c-c++-common/cilk-plus/CK/pr79428-7.c create mode 100644 gcc/testsuite/c-c++-common/goacc/pr79428-1.c create mode 100644 gcc/testsuite/c-c++-common/gomp/pr79428-2.c create mode 100644 gcc/testsuite/c-c++-common/gomp/pr79428-5.c create mode 100644 gcc/testsuite/c-c++-common/gomp/pr79428-6.c create mode 100644 gcc/testsuite/c-c++-common/pr79428-3.c diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 98f7c4ce489..95784d80212 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2017-02-09 Marek Polacek + + PR c/79428 + * c-parser.c (c_parser_omp_ordered): Call c_parser_skip_to_pragma_eol + instead of c_parser_skip_until_found. + 2017-02-09 Jakub Jelinek PR c/79431 diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 8f4f569bd4a..e29924bef6b 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -15462,7 +15462,7 @@ c_parser_omp_ordered (c_parser *parser, enum pragma_context context, if (context != pragma_stmt && context != pragma_compound) { c_parser_error (parser, "expected declaration specifiers"); - c_parser_skip_until_found (parser, CPP_PRAGMA_EOL, NULL); + c_parser_skip_to_pragma_eol (parser, false); return false; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d1b7cf45fc4..c1161fb5338 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2017-02-09 Marek Polacek + + PR c/79428 + * c-c++-common/cilk-plus/CK/pr79428-4.c: New test. + * c-c++-common/cilk-plus/CK/pr79428-7.c: New test. + * c-c++-common/goacc/pr79428-1.c: New test. + * c-c++-common/gomp/pr79428-2.c: New test. + * c-c++-common/gomp/pr79428-5.c: New test. + * c-c++-common/gomp/pr79428-6.c: New test. + * c-c++-common/pr79428-3.c: New test. + 2017-02-09 Andreas Krebbel * gcc.target/s390/s390.exp: Fix test glob pattern for vector diff --git a/gcc/testsuite/c-c++-common/cilk-plus/CK/pr79428-4.c b/gcc/testsuite/c-c++-common/cilk-plus/CK/pr79428-4.c new file mode 100644 index 00000000000..cd4d40686a5 --- /dev/null +++ b/gcc/testsuite/c-c++-common/cilk-plus/CK/pr79428-4.c @@ -0,0 +1,3 @@ +/* PR c/79428 */ +/* { dg-options "-fcilkplus" } */ +#pragma cilk grainsize /* { dg-error "must be inside a function" } */ diff --git a/gcc/testsuite/c-c++-common/cilk-plus/CK/pr79428-7.c b/gcc/testsuite/c-c++-common/cilk-plus/CK/pr79428-7.c new file mode 100644 index 00000000000..bc36f51d914 --- /dev/null +++ b/gcc/testsuite/c-c++-common/cilk-plus/CK/pr79428-7.c @@ -0,0 +1,3 @@ +/* PR c/79428 */ +/* { dg-options "-fcilkplus" } */ +#pragma simd /* { dg-error "must be inside a function" } */ diff --git a/gcc/testsuite/c-c++-common/goacc/pr79428-1.c b/gcc/testsuite/c-c++-common/goacc/pr79428-1.c new file mode 100644 index 00000000000..cf4aeaf6841 --- /dev/null +++ b/gcc/testsuite/c-c++-common/goacc/pr79428-1.c @@ -0,0 +1,6 @@ +/* PR c/79428 */ +/* { dg-options "-fopenacc" } */ +void +foo () +{ +#pragma acc routine /* { dg-error ".#pragma acc routine. must be at file scope|expected" } */ diff --git a/gcc/testsuite/c-c++-common/gomp/pr79428-2.c b/gcc/testsuite/c-c++-common/gomp/pr79428-2.c new file mode 100644 index 00000000000..a26c462dbbd --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr79428-2.c @@ -0,0 +1,7 @@ +/* PR c/79428 */ +/* { dg-options "-fopenmp" } */ +void +foo () +{ +#pragma omp sections +#pragma omp section /* { dg-error "'#pragma omp section' may only be used in '#pragma omp sections' construct|not allowed|expected" } */ diff --git a/gcc/testsuite/c-c++-common/gomp/pr79428-5.c b/gcc/testsuite/c-c++-common/gomp/pr79428-5.c new file mode 100644 index 00000000000..4f2127bccdf --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr79428-5.c @@ -0,0 +1,3 @@ +/* PR c/79428 */ +/* { dg-options "-fopenmp" } */ +#pragma omp ordered /* { dg-error "expected declaration specifiers before end of line" } */ diff --git a/gcc/testsuite/c-c++-common/gomp/pr79428-6.c b/gcc/testsuite/c-c++-common/gomp/pr79428-6.c new file mode 100644 index 00000000000..7e833e27dca --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr79428-6.c @@ -0,0 +1,3 @@ +/* PR c/79428 */ +/* { dg-options "-fopenmp" } */ +#pragma omp target /* { dg-error "expected declaration specifiers before end of line" } */ diff --git a/gcc/testsuite/c-c++-common/pr79428-3.c b/gcc/testsuite/c-c++-common/pr79428-3.c new file mode 100644 index 00000000000..ec7077de55f --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr79428-3.c @@ -0,0 +1,3 @@ +/* PR c/79428 */ +int i; +#pragma GCC pch_preprocess /* { dg-error "'#pragma GCC pch_preprocess' must be first" } */ -- 2.30.2