This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch] PR c/7490
- From: Philippe Trebuchet <Philippe dot Trebuchet at sophia dot inria dot fr>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gdr at integrable-solutions dot net, gcc-patches at gcc dot gnu dot org, ebotcazou at libertysurf dot fr
- Date: Mon, 09 Dec 2002 18:36:13 +0100
- Subject: Re: [Patch] PR c/7490
- Organization: Tres Tres Peu
- References: <200211261349.gAQDnJrZ019890@charybde.inria.fr> <20021126181907.GD29756@redhat.com>
Hi,
I have modified my patch to be compatible with Eric's one for PR 7622,
here is
the new revision. Modifications are still in genrtl_scope_statement
because
it prevents looping across all local def twice. There no check about
aliases
exept that it prevent aliasing in nested scope.
Index: gcc/c-semantics.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/c-semantics.c,v
retrieving revision 1.47
diff -c -p -3 -r1.47 c-semantics.c
*** gcc/c-semantics.c 22 Sep 2002 02:03:15 -0000 1.47
--- gcc/c-semantics.c 9 Dec 2002 17:15:37 -0000
*************** void
*** 589,595 ****
genrtl_scope_stmt (t)
tree t;
{
! tree block = SCOPE_STMT_BLOCK (t);
if (!SCOPE_NO_CLEANUPS_P (t))
{
--- 589,596 ----
genrtl_scope_stmt (t)
tree t;
{
! int flag_inline_nested=0;
! tree parent, block = SCOPE_STMT_BLOCK (t);
if (!SCOPE_NO_CLEANUPS_P (t))
{
*************** genrtl_scope_stmt (t)
*** 607,615 ****
NOTE_BLOCK (note) = block;
}
! /* If we're at the end of a scope that contains inlined nested
! functions, we have to decide whether or not to write them out.
*/
! if (block && SCOPE_END_P (t))
{
tree fn;
--- 608,625 ----
NOTE_BLOCK (note) = block;
}
! /* check wether it is a nested function, inside
! * an extern inline one */
! for (parent = current_function_decl;
! parent != NULL_TREE;
! parent = get_containing_scope (parent))
! if (TREE_CODE (parent) == FUNCTION_DECL
! && DECL_INLINE (parent) && DECL_EXTERNAL (parent))
! flag_inline_nested=1;
!
! /* If we're at the end of a scope that contains inlined nested
! * functions, we have to decide whether or not to write them out.
*/
! if (block && SCOPE_END_P (t) && !flag_inline_nested)
{
tree fn;
*************** genrtl_scope_stmt (t)
*** 620,628 ****
&& !TREE_ASM_WRITTEN (fn)
&& TREE_ADDRESSABLE (fn))
{
! push_function_context ();
! output_inline_function (fn);
! pop_function_context ();
}
}
}
--- 630,654 ----
&& !TREE_ASM_WRITTEN (fn)
&& TREE_ADDRESSABLE (fn))
{
! tree alias;
! alias = lookup_attribute ("alias", DECL_ATTRIBUTES (fn));
! if (alias)
! {
! alias=TREE_VALUE(TREE_VALUE(alias));
! error(" `%s' declaring an alias in a nested scope",
! TREE_STRING_POINTER(alias));
! }
! else if (DECL_SAVED_INSNS (fn) != NULL)
! {
! push_function_context ();
! output_inline_function (fn);
! pop_function_context ();
! }
! else
! {
! error ("no definition for auto nested function `%s'",
! IDENTIFIER_POINTER (DECL_NAME (fn)));
! }
}
}
}
--
Philippe