diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-01-29 15:47:19 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-01-29 15:47:19 +0000 |
commit | ed6049c8d4abb6da11e251490ff3ca6d3c1cada4 (patch) | |
tree | 7b6cda1d150280c50f4c6d2bbb388db41dc4fa4d /gcc/tree-inline.c | |
parent | 830a6615b11231355af6fbe3ac324301b7014e2f (diff) | |
download | gcc-ed6049c8d4abb6da11e251490ff3ca6d3c1cada4.tar.gz |
2008-01-29 Richard Guenther <rguenther@suse.de>
PR middle-end/35006
* tree-inline.h (struct copy_body_data): Add remapping_type_depth
field.
* tree-inline.c (remap_type): Increment remapping_type_depth
around remapping types.
(copy_body_r): Only add referenced variables if they are referenced
from code, not types.
* gcc.c-torture/compile/pr35006.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131939 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r-- | gcc/tree-inline.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 636e37d8024..d2ef9619eb2 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -409,6 +409,7 @@ tree remap_type (tree type, copy_body_data *id) { tree *node; + tree tmp; if (type == NULL) return type; @@ -425,7 +426,11 @@ remap_type (tree type, copy_body_data *id) return type; } - return remap_type_1 (type, id); + id->remapping_type_depth++; + tmp = remap_type_1 (type, id); + id->remapping_type_depth--; + + return tmp; } static tree @@ -723,9 +728,10 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data) tweak some special cases. */ copy_tree_r (tp, walk_subtrees, NULL); - /* Global variables we didn't seen yet needs to go into referenced - vars. */ - if (gimple_in_ssa_p (cfun) && TREE_CODE (*tp) == VAR_DECL) + /* Global variables we haven't seen yet needs to go into referenced + vars. If not referenced from types only. */ + if (gimple_in_ssa_p (cfun) && TREE_CODE (*tp) == VAR_DECL + && id->remapping_type_depth == 0) add_referenced_var (*tp); /* If EXPR has block defined, map it to newly constructed block. |