re PR c++/58703 (ICE with invalid types in OpenMP declare reduction clause)

PR c++/58703
	* parser.c (cp_parser_omp_declare_reduction): Save and free
	declarator_obstack.

	* c-c++-common/gomp/pr58703.c: New test.

From-SVN: r207511
This commit is contained in:
Jakub Jelinek 2014-02-05 16:32:01 +01:00 committed by Jakub Jelinek
parent f0f91770c3
commit 54e19c00d9
4 changed files with 26 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2014-02-05 Jakub Jelinek <jakub@redhat.com>
PR c++/58703
* parser.c (cp_parser_omp_declare_reduction): Save and free
declarator_obstack.
2014-02-03 Marc Glisse <marc.glisse@inria.fr>
PR c++/53017

View File

@ -30623,6 +30623,10 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok,
cp_token *first_token;
cp_token_cache *cp;
int errs;
void *p;
/* Get the high-water mark for the DECLARATOR_OBSTACK. */
p = obstack_alloc (&declarator_obstack, 0);
if (!cp_parser_require (parser, CPP_OPEN_PAREN, RT_OPEN_PAREN))
goto fail;
@ -30731,7 +30735,7 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok,
{
fail:
cp_parser_skip_to_pragma_eol (parser, pragma_tok);
return;
goto done;
}
first_token = cp_lexer_peek_token (parser->lexer);
@ -30835,6 +30839,10 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok,
}
cp_parser_require_pragma_eol (parser, pragma_tok);
done:
/* Free any declarators allocated. */
obstack_free (&declarator_obstack, p);
}
/* OpenMP 4.0

View File

@ -1,3 +1,8 @@
2014-02-05 Jakub Jelinek <jakub@redhat.com>
PR c++/58703
* c-c++-common/gomp/pr58703.c: New test.
2014-02-05 Richard Biener <rguenther@suse.de>
PR testsuite/60076

View File

@ -0,0 +1,6 @@
/* PR c++/58703 */
/* { dg-do compile } */
/* { dg-options "-fopenmp" } */
#pragma omp declare reduction (+ : char[] : omp_out += omp_in) /* { dg-error "function or array type" } */
#pragma omp declare reduction (+ : char() : omp_out += omp_in) /* { dg-error "function or array type" } */