aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2010-03-26 23:52:09 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2010-03-26 23:52:09 +0000
commit10e76c1a45d1efa0f4637ec4bb09fbc6005ed3fd (patch)
tree8dd23f7d006e9f449c212ce5cea214baccf360b6 /gcc/c-decl.c
parentc6cc83d0c956ff38234275106c582edac67d3e39 (diff)
downloadgcc-10e76c1a45d1efa0f4637ec4bb09fbc6005ed3fd.zip
gcc-10e76c1a45d1efa0f4637ec4bb09fbc6005ed3fd.tar.gz
gcc-10e76c1a45d1efa0f4637ec4bb09fbc6005ed3fd.tar.bz2
re PR c/43381 (infinite loop in gcc.dg/parm-impl-decl-1.c with -g)
PR c/43381 * c-decl.c (get_parm_info): Assert that decl going in OTHERS has a nested binding iff it is a FUNCTION_DECL. (store_parm_decls_newstyle): Pass nested=true to bind for FUNCTION_DECLs amongst parameters. testsuite: * gcc.dg/parm-impl-decl-3.c: New test. From-SVN: r157766
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index fed04dc..b6ff3f4 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -6303,6 +6303,11 @@ get_parm_info (bool ellipsis)
type itself. FUNCTION_DECLs appear when there is an implicit
function declaration in the parameter list. */
+ /* 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);
TREE_CHAIN (decl) = others;
others = decl;
/* fall through */
@@ -7624,7 +7629,9 @@ store_parm_decls_newstyle (tree fndecl, const struct c_arg_info *arg_info)
DECL_CONTEXT (decl) = current_function_decl;
if (DECL_NAME (decl))
bind (DECL_NAME (decl), decl, current_scope,
- /*invisible=*/false, /*nested=*/false, UNKNOWN_LOCATION);
+ /*invisible=*/false,
+ /*nested=*/(TREE_CODE (decl) == FUNCTION_DECL),
+ UNKNOWN_LOCATION);
}
/* And all the tag declarations. */