summaryrefslogtreecommitdiff
path: root/gcc/tree-dfa.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2006-12-20 22:45:42 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2006-12-20 22:45:42 +0000
commit19bda1b4aceae95d5fb49e6e740364eb3311c34c (patch)
treea2fec6c9ebf71881ab6fe59d10b7f82e28154a37 /gcc/tree-dfa.c
parentf5ab006bf3e5e6f8e8036e036d8bd1b151c82f60 (diff)
downloadgcc-19bda1b4aceae95d5fb49e6e740364eb3311c34c.tar.gz
* tree-dfa.c (add_referenced_var): Walk initializers of
non-constant/readonly static vars. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120090 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-dfa.c')
-rw-r--r--gcc/tree-dfa.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 5b9c72418b5..9c30eb53e19 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -741,15 +741,13 @@ add_referenced_var (tree var)
/* Scan DECL_INITIAL for pointer variables as they may contain
address arithmetic referencing the address of other
- variables. */
+ variables.
+ Even non-constant intializers need to be walked, because
+ IPA passes might prove that their are invariant later on. */
if (DECL_INITIAL (var)
/* Initializers of external variables are not useful to the
optimizers. */
- && !DECL_EXTERNAL (var)
- /* It's not necessary to walk the initial value of non-constant
- variables because it cannot be propagated by the
- optimizers. */
- && (TREE_CONSTANT (var) || TREE_READONLY (var)))
+ && !DECL_EXTERNAL (var))
walk_tree (&DECL_INITIAL (var), find_vars_r, NULL, 0);
}
}