diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 1fe4f820c85..2e54e5657e4 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2016-03-04 Bernd Schmidt + + PR c/69824 + * c-decl.c (get_parm_info): Don't queue implicit function declarations + for later. + 2016-03-04 Marek Polacek PR c/69798 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 298036a4eec..bab47153235 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -7050,25 +7050,28 @@ get_parm_info (bool ellipsis, tree expr) vec_safe_push (tags, tag); break; + case FUNCTION_DECL: + /* FUNCTION_DECLs appear when there is an implicit function + declaration in the parameter list. */ + gcc_assert (b->nested); + goto set_shadowed; + case CONST_DECL: case TYPE_DECL: - case FUNCTION_DECL: /* CONST_DECLs appear here when we have an embedded enum, and TYPE_DECLs appear here when we have an embedded struct or union. No warnings for this - we already warned about the - type itself. FUNCTION_DECLs appear when there is an implicit - function declaration in the parameter list. */ + type itself. */ /* When we reinsert this decl in the function body, we need to reconstruct whether it was marked as nested. */ - gcc_assert (TREE_CODE (decl) == FUNCTION_DECL - ? b->nested - : !b->nested); + gcc_assert (!b->nested); DECL_CHAIN (decl) = others; others = decl; /* fall through */ case ERROR_MARK: + set_shadowed: /* error_mark_node appears here when we have an undeclared variable. Just throw it away. */ if (b->id) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 51469eaee81..3fb4fe1b6bc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-03-04 Bernd Schmidt + + PR c/69824 + * gcc.dg/pr69824.c: New test. + 2016-03-05 Tom de Vries * c-c++-common/goacc/nesting-fail-1.c (f_acc_routine): New function. diff --git a/gcc/testsuite/gcc.dg/pr69824.c b/gcc/testsuite/gcc.dg/pr69824.c new file mode 100644 index 00000000000..e2913f8f3d0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr69824.c @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-options "-w" } */ +int bar() { return foo(); } +void baz(int c[foo()]) { return; }