re PR c/89211 (ICE in int_mode_for_mode, at stor-layout.c:403)

PR c/89211
	* c-parser.c (c_parser_declaration_or_fndef): Don't update
	DECL_ARGUMENTS of d if it has been defined already.  Use a single if
	instead of 3 nested ifs.

	* gcc.dg/pr89211.c: New test.

From-SVN: r268574
This commit is contained in:
Jakub Jelinek 2019-02-06 10:17:55 +01:00 committed by Jakub Jelinek
parent 4763581763
commit cfc30fd175
4 changed files with 24 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2019-02-06 Jakub Jelinek <jakub@redhat.com>
PR c/89211
* c-parser.c (c_parser_declaration_or_fndef): Don't update
DECL_ARGUMENTS of d if it has been defined already. Use a single if
instead of 3 nested ifs.
2019-02-06 Joseph Myers <joseph@codesourcery.com>
PR c/88584

View File

@ -2154,10 +2154,12 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
tree d = start_decl (declarator, specs, false,
chainon (postfix_attrs,
all_prefix_attrs));
if (d && TREE_CODE (d) == FUNCTION_DECL)
if (declarator->kind == cdk_function)
if (DECL_ARGUMENTS (d) == NULL_TREE)
DECL_ARGUMENTS (d) = declarator->u.arg_info->parms;
if (d
&& TREE_CODE (d) == FUNCTION_DECL
&& declarator->kind == cdk_function
&& DECL_ARGUMENTS (d) == NULL_TREE
&& DECL_INITIAL (d) == NULL_TREE)
DECL_ARGUMENTS (d) = declarator->u.arg_info->parms;
if (omp_declare_simd_clauses.exists ())
{
tree parms = NULL_TREE;

View File

@ -1,5 +1,8 @@
2019-02-06 Jakub Jelinek <jakub@redhat.com>
PR c/89211
* gcc.dg/pr89211.c: New test.
PR middle-end/89210
* c-c++-common/builtin-convertvector-2.c: New test.

View File

@ -0,0 +1,8 @@
/* PR c/89211 */
/* { dg-do compile } */
void foo ();
void foo ()
{
void foo (struct S); /* { dg-warning "declared inside parameter list" } */
}