diff options
author | matz <matz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-17 16:03:56 +0000 |
---|---|---|
committer | matz <matz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-17 16:03:56 +0000 |
commit | 421e1d45b70c03c18cea5163d7fd0698d039cfeb (patch) | |
tree | 245143a3e05707fc470557d9f2aeca06bcf98851 /gcc/tree-ssa-live.c | |
parent | 6aaf42adb4b0443f974e66bb9d04c8851837851a (diff) | |
download | gcc-421e1d45b70c03c18cea5163d7fd0698d039cfeb.tar.gz |
PR middle-end/50644
PR middle-end/50741
* tree-ssa-live.c (mark_all_vars_used_1): Recurse only for decls of
current function.
(remove_unused_locals): Ditto.
testsuite/
* g++.dg/tree-ssa/pr50741.C: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181443 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-live.c')
-rw-r--r-- | gcc/tree-ssa-live.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index 2a2c13393fe..b8a056ebdac 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -374,7 +374,8 @@ mark_all_vars_used_1 (tree *tp, int *walk_subtrees, void *data) eliminated as unused. */ if (TREE_CODE (t) == VAR_DECL) { - if (data != NULL && bitmap_clear_bit ((bitmap) data, DECL_UID (t))) + if (data != NULL && bitmap_clear_bit ((bitmap) data, DECL_UID (t)) + && DECL_CONTEXT (t) == current_function_decl) mark_all_vars_used (&DECL_INITIAL (t), data); set_is_used (t); } @@ -836,7 +837,8 @@ remove_unused_locals (void) if (TREE_CODE (var) == VAR_DECL && is_global_var (var) && var_ann (var) != NULL - && is_used_p (var)) + && is_used_p (var) + && DECL_CONTEXT (var) == current_function_decl) mark_all_vars_used (&DECL_INITIAL (var), global_unused_vars); num = VEC_length (tree, cfun->local_decls); |