openmp: Fix parallel master error recovery [PR94512]

We need to set OMP_PARALLEL_COMBINED only if the parsing of omp_master
succeeded, because otherwise there is no nested master construct in the
parallel.

2020-04-07  Jakub Jelinek  <jakub@redhat.com>

	PR c++/94512
	* c-parser.c (c_parser_omp_parallel): Set OMP_PARALLEL_COMBINED
	if c_parser_omp_master succeeded.

	* parser.c (cp_parser_omp_parallel): Set OMP_PARALLEL_COMBINED
	if cp_parser_omp_master succeeded.

	* g++.dg/gomp/pr94512.C: New test.
This commit is contained in:
Jakub Jelinek 2020-04-07 14:30:53 +02:00
parent 7a6588fe65
commit 4df50a059f
6 changed files with 35 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2020-04-07 Jakub Jelinek <jakub@redhat.com>
PR c++/94512
* c-parser.c (c_parser_omp_parallel): Set OMP_PARALLEL_COMBINED
if c_parser_omp_master succeeded.
2020-03-23 Jakub Jelinek <jakub@redhat.com>
PR gcov-profile/94029

View File

@ -18877,9 +18877,9 @@ c_parser_omp_parallel (location_t loc, c_parser *parser,
stmt = c_finish_omp_parallel (loc,
cclauses[C_OMP_CLAUSE_SPLIT_PARALLEL],
block);
OMP_PARALLEL_COMBINED (stmt) = 1;
if (ret == NULL)
return ret;
OMP_PARALLEL_COMBINED (stmt) = 1;
return stmt;
}
else if (strcmp (p, "loop") == 0)

View File

@ -1,3 +1,9 @@
2020-04-07 Jakub Jelinek <jakub@redhat.com>
PR c++/94512
* parser.c (cp_parser_omp_parallel): Set OMP_PARALLEL_COMBINED
if cp_parser_omp_master succeeded.
2020-04-06 Jason Merrill <jason@redhat.com>
PR c++/94462

View File

@ -39818,9 +39818,9 @@ cp_parser_omp_parallel (cp_parser *parser, cp_token *pragma_tok,
cp_parser_end_omp_structured_block (parser, save);
stmt = finish_omp_parallel (cclauses[C_OMP_CLAUSE_SPLIT_PARALLEL],
block);
OMP_PARALLEL_COMBINED (stmt) = 1;
if (ret == NULL_TREE)
return ret;
OMP_PARALLEL_COMBINED (stmt) = 1;
return stmt;
}
else if (strcmp (p, "loop") == 0)

View File

@ -1,5 +1,8 @@
2020-04-07 Jakub Jelinek <jakub@redhat.com>
PR c++/94512
* g++.dg/gomp/pr94512.C: New test.
PR target/94500
* gcc.target/i386/avx512bw-pr94500.c: New test.

View File

@ -0,0 +1,18 @@
// PR c++/94512
void
foo ();
template <int>
void
bar ()
{
#pragma omp parallel master taskloop
foo (); // { dg-error "for statement expected before" }
}
void
baz ()
{
bar<0> ();
}