As discussed in the PR, this changes a call to c_parser_skip_until_found into c_parser_skip_to_pragma_eol to avoid crashing on an assert in c_parser_consume_token (CPP_PRAGMA_EOLs shouldn't be consumed in that way).
Bootstrapped/regtested on x86_64-linux, ok for trunk? 2017-02-09 Marek Polacek <pola...@redhat.com> 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. diff --git gcc/c/c-parser.c gcc/c/c-parser.c index 5c152ab..ce2ef0f 100644 --- gcc/c/c-parser.c +++ gcc/c/c-parser.c @@ -15460,7 +15460,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 gcc/testsuite/c-c++-common/cilk-plus/CK/pr79428-4.c gcc/testsuite/c-c++-common/cilk-plus/CK/pr79428-4.c index e69de29..cd4d406 100644 --- gcc/testsuite/c-c++-common/cilk-plus/CK/pr79428-4.c +++ 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 gcc/testsuite/c-c++-common/cilk-plus/CK/pr79428-7.c gcc/testsuite/c-c++-common/cilk-plus/CK/pr79428-7.c index e69de29..bc36f51 100644 --- gcc/testsuite/c-c++-common/cilk-plus/CK/pr79428-7.c +++ 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 gcc/testsuite/c-c++-common/goacc/pr79428-1.c gcc/testsuite/c-c++-common/goacc/pr79428-1.c index e69de29..cf4aeaf 100644 --- gcc/testsuite/c-c++-common/goacc/pr79428-1.c +++ 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 gcc/testsuite/c-c++-common/gomp/pr79428-2.c gcc/testsuite/c-c++-common/gomp/pr79428-2.c index e69de29..a26c462 100644 --- gcc/testsuite/c-c++-common/gomp/pr79428-2.c +++ 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 gcc/testsuite/c-c++-common/gomp/pr79428-5.c gcc/testsuite/c-c++-common/gomp/pr79428-5.c index e69de29..4f2127b 100644 --- gcc/testsuite/c-c++-common/gomp/pr79428-5.c +++ 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 gcc/testsuite/c-c++-common/gomp/pr79428-6.c gcc/testsuite/c-c++-common/gomp/pr79428-6.c index e69de29..7e833e2 100644 --- gcc/testsuite/c-c++-common/gomp/pr79428-6.c +++ 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 gcc/testsuite/c-c++-common/pr79428-3.c gcc/testsuite/c-c++-common/pr79428-3.c index e69de29..ec7077d 100644 --- gcc/testsuite/c-c++-common/pr79428-3.c +++ 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" } */ Marek