From: Marek Polacek Date: Wed, 8 Jun 2016 06:41:55 +0000 (+0000) Subject: re PR c/71426 (gcc ICE on x86_64-linux-gnu in get_parm_info, at c/c-decl.c:7059) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=08203f73d119a1f01c2b604ba445ef29bdb1b410;p=gcc.git re PR c/71426 (gcc ICE on x86_64-linux-gnu in get_parm_info, at c/c-decl.c:7059) PR c/71426 * c-decl.c (get_parm_info): Don't crash on an assert on invalid code. * gcc.dg/noncompile/pr71426.c: New test. From-SVN: r237196 --- diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 8617f08f978..9f0b91afb6a 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -3,6 +3,10 @@ PR c/71418 * c-decl.c (grokdeclarator): Check TYPE_P. + PR c/71426 + * c-decl.c (get_parm_info): Don't crash on an assert on invalid + code. + 2016-06-07 David Malcolm * c-parser.c (c_parser_postfix_expression): In __builtin_offsetof diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index ac83e2fa519..5c08c5947c0 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -7054,9 +7054,9 @@ get_parm_info (bool ellipsis, tree expr) break; case FUNCTION_DECL: - /* FUNCTION_DECLs appear when there is an implicit function - declaration in the parameter list. */ - gcc_assert (b->nested); + /* FUNCTION_DECLs appear when there is an implicit function + declaration in the parameter list. */ + gcc_assert (b->nested || seen_error ()); goto set_shadowed; case CONST_DECL: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 607f21c3329..0177653452b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,6 +3,9 @@ PR c/71418 * gcc.dg/noncompile/pr71418.c: New test. + PR c/71426 + * gcc.dg/noncompile/pr71426.c: New test. + 2016-06-07 Jan Hubicka * gcc.dg/ipa/inlinehint-4.c: Disable partial inlining. diff --git a/gcc/testsuite/gcc.dg/noncompile/pr71426.c b/gcc/testsuite/gcc.dg/noncompile/pr71426.c new file mode 100644 index 00000000000..874e18976e9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/noncompile/pr71426.c @@ -0,0 +1,5 @@ +/* PR c/71426 */ +/* { dg-do compile } */ +/* { dg-options "-w" } */ + +int f (int x[x - x ()]); /* { dg-error "undeclared" } */