This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix inliner versus nested functions and arrays of variable lengths
- From: Eric Christopher <echristo at apple dot com>
- To: Jan Hubicka <jh at suse dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 7 Jan 2007 17:48:30 -0800
- Subject: Re: Fix inliner versus nested functions and arrays of variable lengths
- References: <20070107212109.GD9578@kam.mff.cuni.cz>
:ADDPATCH tree-optimization:
* tree-inline.c (copy_body_r): Do not add local variables of other
functions.
Index: tree-inline.c
===================================================================
--- tree-inline.c (revision 120528)
+++ tree-inline.c (working copy)
@@ -691,7 +691,9 @@ copy_body_r (tree *tp, int *walk_subtree
/* Global variables we didn't seen yet needs to go into
referenced
vars. */
- if (gimple_in_ssa_p (cfun) && TREE_CODE (*tp) == VAR_DECL)
+ if (gimple_in_ssa_p (cfun) && TREE_CODE (*tp) == VAR_DECL
+ && (is_global_var (*tp)
+ || decl_function_context (*tp) == current_function_decl))
add_referenced_var (*tp);
/* If EXPR has block defined, map it to newly constructed
block.
Can you update the comment while you're at it? FWIW to fix the
grammar as well it should be
"Global variables we haven't seen yet need to go into referenced vars."
-eric