From: Jakub Jelinek Date: Wed, 6 Feb 2019 09:17:55 +0000 (+0100) Subject: re PR c/89211 (ICE in int_mode_for_mode, at stor-layout.c:403) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cfc30fd17588446c8c54c6e1e77dec2dc18ba0fb;p=gcc.git 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 --- diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 9bb8351cc2c..ebe944a57cb 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,10 @@ +2019-02-06 Jakub Jelinek + + 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 PR c/88584 diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 76f314e1190..cacbf0ac495 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b5c92ffb6b6..e37a9481602 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2019-02-06 Jakub Jelinek + PR c/89211 + * gcc.dg/pr89211.c: New test. + PR middle-end/89210 * c-c++-common/builtin-convertvector-2.c: New test. diff --git a/gcc/testsuite/gcc.dg/pr89211.c b/gcc/testsuite/gcc.dg/pr89211.c new file mode 100644 index 00000000000..cf721aa5f62 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr89211.c @@ -0,0 +1,8 @@ +/* PR c/89211 */ +/* { dg-do compile } */ + +void foo (); +void foo () +{ + void foo (struct S); /* { dg-warning "declared inside parameter list" } */ +}