* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157766
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
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 */
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. */
+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
--- /dev/null
+/* 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; }