From 79878c89e6d6675f2b92b28333bb2afc8589a036 Mon Sep 17 00:00:00 2001 From: jakub Date: Thu, 16 Feb 2017 12:02:24 +0000 Subject: [PATCH] PR c++/79512 c/ * c-parser.c (c_parser_omp_target): For -fopenmp-simd ignore #pragma omp target even when not followed by identifier. cp/ * parser.c (cp_parser_omp_target): For -fopenmp-simd ignore #pragma omp target even when not followed by identifier. testsuite/ * c-c++-common/gomp/pr79512.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245504 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c/ChangeLog | 6 ++++++ gcc/c/c-parser.c | 5 +++++ gcc/cp/ChangeLog | 6 ++++++ gcc/cp/parser.c | 5 +++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/c-c++-common/gomp/pr79512.c | 14 ++++++++++++++ 6 files changed, 41 insertions(+) create mode 100644 gcc/testsuite/c-c++-common/gomp/pr79512.c diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 3e585b0e4ca..2a198ef47db 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2017-02-16 Jakub Jelinek + + PR c++/79512 + * c-parser.c (c_parser_omp_target): For -fopenmp-simd + ignore #pragma omp target even when not followed by identifier. + 2017-02-14 Prathamesh Kulkarni * gimpler-parser.c (c_parser_gimple_statement): Handle ABS_EXPR. diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 2297750fbab..968c1dc7696 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -16505,6 +16505,11 @@ c_parser_omp_target (c_parser *parser, enum pragma_context context, bool *if_p) return c_parser_omp_target_update (loc, parser, context); } } + if (!flag_openmp) /* flag_openmp_simd */ + { + c_parser_skip_to_pragma_eol (parser, false); + return false; + } stmt = make_node (OMP_TARGET); TREE_TYPE (stmt) = void_type_node; diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d346d687d93..b48a6f2cc03 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-02-16 Jakub Jelinek + + PR c++/79512 + * parser.c (cp_parser_omp_target): For -fopenmp-simd + ignore #pragma omp target even when not followed by identifier. + 2017-02-15 Jason Merrill Jakub Jelinek diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index cd41ee6a3c3..060962db625 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -35981,6 +35981,11 @@ cp_parser_omp_target (cp_parser *parser, cp_token *pragma_tok, return cp_parser_omp_target_update (parser, pragma_tok, context); } } + if (!flag_openmp) /* flag_openmp_simd */ + { + cp_parser_skip_to_pragma_eol (parser, pragma_tok); + return false; + } stmt = make_node (OMP_TARGET); TREE_TYPE (stmt) = void_type_node; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 85624d9d503..380457732e2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-02-16 Jakub Jelinek + + PR c++/79512 + * c-c++-common/gomp/pr79512.c: New test. + 2017-02-15 Martin Sebor PR c++/79363 diff --git a/gcc/testsuite/c-c++-common/gomp/pr79512.c b/gcc/testsuite/c-c++-common/gomp/pr79512.c new file mode 100644 index 00000000000..19ddfaffc36 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr79512.c @@ -0,0 +1,14 @@ +/* PR c++/79512 */ +/* { dg-options "-fopenmp-simd" } */ + +void +foo (void) +{ + #pragma omp target + #pragma omp teams + { + int i; + for (i = 0; i < 10; i++) + ; + } +} -- 2.11.4.GIT