Commit 54e19c00 by Jakub Jelinek Committed by Jakub Jelinek

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
parent f0f91770
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> 2014-02-03 Marc Glisse <marc.glisse@inria.fr>
PR c++/53017 PR c++/53017
......
...@@ -30623,6 +30623,10 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok, ...@@ -30623,6 +30623,10 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok,
cp_token *first_token; cp_token *first_token;
cp_token_cache *cp; cp_token_cache *cp;
int errs; 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)) if (!cp_parser_require (parser, CPP_OPEN_PAREN, RT_OPEN_PAREN))
goto fail; goto fail;
...@@ -30731,7 +30735,7 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok, ...@@ -30731,7 +30735,7 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok,
{ {
fail: fail:
cp_parser_skip_to_pragma_eol (parser, pragma_tok); cp_parser_skip_to_pragma_eol (parser, pragma_tok);
return; goto done;
} }
first_token = cp_lexer_peek_token (parser->lexer); first_token = cp_lexer_peek_token (parser->lexer);
...@@ -30835,6 +30839,10 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok, ...@@ -30835,6 +30839,10 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok,
} }
cp_parser_require_pragma_eol (parser, pragma_tok); cp_parser_require_pragma_eol (parser, pragma_tok);
done:
/* Free any declarators allocated. */
obstack_free (&declarator_obstack, p);
} }
/* OpenMP 4.0 /* OpenMP 4.0
......
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> 2014-02-05 Richard Biener <rguenther@suse.de>
PR testsuite/60076 PR testsuite/60076
......
/* 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" } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment