From: Jakub Jelinek Date: Thu, 16 Feb 2017 12:02:24 +0000 (+0100) Subject: re PR c++/79512 (ICE: Segfault in gimple_build_call_1, at gimple.c:218) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bcac0b4dac8901040c029922589d7a06a119b574;p=gcc.git re PR c++/79512 (ICE: Segfault in gimple_build_call_1, at gimple.c:218) 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. From-SVN: r245504 --- 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++) + ; + } +}