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
This commit is contained in:
Joseph Myers 2010-03-26 23:52:09 +00:00 committed by Joseph Myers
parent c6cc83d0c9
commit 10e76c1a45
4 changed files with 49 additions and 1 deletions

View File

@ -1,3 +1,11 @@
2010-03-26 Joseph Myers <joseph@codesourcery.com>
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.
2010-03-26 Jakub Jelinek <jakub@redhat.com>
* var-tracking.c (vt_expand_loc_callback): Don't run

View File

@ -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. */

View File

@ -1,3 +1,8 @@
2010-03-26 Joseph Myers <joseph@codesourcery.com>
PR c/43381
* gcc.dg/parm-impl-decl-3.c: New test.
2010-03-26 Jason Merrill <jason@redhat.com>
PR c++/43509

View File

@ -0,0 +1,28 @@
/* Like parm-impl-decl-1.c, but with -g. PR 43381. */
/* Origin: Joseph Myers <joseph@codesourcery.com> */
/* { dg-do compile } */
/* { dg-options "-g" } */
int
foo (int __attribute__ ((__mode__ (vector_size(8)))) i) /* { dg-warning "'__mode__' attribute ignored" } */
{
return (long long) i;
}
int f (int [sizeof(g())]);
int f1 (int [sizeof(g1())]);
int g () { return 1; }
int
h (int (*p)[sizeof(i())])
{
int g2 (), g3 ();
return (*p)[0] + g3() + g2();
}
int i () { return 2; }
int f2 (int [sizeof(g2())]);
int f3 (int [sizeof(g3())]);
int g3 () { return 4; }