re PR c++/79429 (ICE in add_stmt, at cp/semantics.c:385)

PR c++/79429
	* parser.c (cp_parser_omp_ordered): Don't check for non-pragma_stmt
	non-pragma_compound context here.
	(cp_parser_omp_target): Likewise.
	(cp_parser_pragma): Don't call push_omp_privatization_clauses and
	parsing for ordered and target omp pragmas in non-pragma_stmt
	non-pragma_compound contexts.

	* c-c++-common/gomp/pr79429.c: New test.
	* g++.dg/gomp/pr79429.C: New test.

From-SVN: r245303
This commit is contained in:
Jakub Jelinek 2017-02-09 15:06:58 +01:00 committed by Jakub Jelinek
parent 56f7147848
commit f08683a154
5 changed files with 22 additions and 14 deletions

View File

@ -1,5 +1,13 @@
2017-02-09 Jakub Jelinek <jakub@redhat.com>
PR c++/79429
* parser.c (cp_parser_omp_ordered): Don't check for non-pragma_stmt
non-pragma_compound context here.
(cp_parser_omp_target): Likewise.
(cp_parser_pragma): Don't call push_omp_privatization_clauses and
parsing for ordered and target omp pragmas in non-pragma_stmt
non-pragma_compound contexts.
PR c/79431
* parser.c (cp_parser_oacc_declare): Formatting fix.
(cp_parser_omp_declare_target): Don't invoke symtab_node::get on

View File

@ -34934,13 +34934,6 @@ cp_parser_omp_ordered (cp_parser *parser, cp_token *pragma_tok,
{
location_t loc = pragma_tok->location;
if (context != pragma_stmt && context != pragma_compound)
{
cp_parser_error (parser, "expected declaration specifiers");
cp_parser_skip_to_pragma_eol (parser, pragma_tok);
return false;
}
if (cp_lexer_next_token_is (parser->lexer, CPP_NAME))
{
tree id = cp_lexer_peek_token (parser->lexer)->u.value;
@ -35846,13 +35839,6 @@ cp_parser_omp_target (cp_parser *parser, cp_token *pragma_tok,
{
tree *pc = NULL, stmt;
if (context != pragma_stmt && context != pragma_compound)
{
cp_parser_error (parser, "expected declaration specifiers");
cp_parser_skip_to_pragma_eol (parser, pragma_tok);
return false;
}
if (cp_lexer_next_token_is (parser->lexer, CPP_NAME))
{
tree id = cp_lexer_peek_token (parser->lexer)->u.value;
@ -38283,12 +38269,16 @@ cp_parser_pragma (cp_parser *parser, enum pragma_context context, bool *if_p)
return true;
case PRAGMA_OMP_ORDERED:
if (context != pragma_stmt && context != pragma_compound)
goto bad_stmt;
stmt = push_omp_privatization_clauses (false);
ret = cp_parser_omp_ordered (parser, pragma_tok, context, if_p);
pop_omp_privatization_clauses (stmt);
return ret;
case PRAGMA_OMP_TARGET:
if (context != pragma_stmt && context != pragma_compound)
goto bad_stmt;
stmt = push_omp_privatization_clauses (false);
ret = cp_parser_omp_target (parser, pragma_tok, context, if_p);
pop_omp_privatization_clauses (stmt);

View File

@ -1,5 +1,9 @@
2017-02-09 Jakub Jelinek <jakub@redhat.com>
PR c++/79429
* c-c++-common/gomp/pr79429.c: New test.
* g++.dg/gomp/pr79429.C: New test.
PR c/79431
* c-c++-common/gomp/pr79431.c: New test.

View File

@ -0,0 +1,3 @@
/* PR c++/79429 */
#pragma omp target /* { dg-error "expected declaration specifiers" } */

View File

@ -0,0 +1,3 @@
// PR c++/79429
#pragma omp ordered // { dg-error "expected declaration specifiers" }