This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix inliner versus nested functions and arrays of variable lengths



: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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]