diff options
author | Jan Hubicka <jh@suse.cz> | 2010-09-28 18:28:39 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2010-09-28 16:28:39 +0000 |
commit | 697c3575e2a72e4957cccd73a32930f8697847bd (patch) | |
tree | e1c07b1338c16183ef661f24ea71635de02d9505 /gcc/gimple-fold.c | |
parent | 2770264a75b500cb6b21772223718a2eab620968 (diff) | |
download | gcc-697c3575e2a72e4957cccd73a32930f8697847bd.zip gcc-697c3575e2a72e4957cccd73a32930f8697847bd.tar.gz gcc-697c3575e2a72e4957cccd73a32930f8697847bd.tar.bz2 |
tree-ssa-ccp.c (fold_ctor_reference): New function.
* tree-ssa-ccp.c (fold_ctor_reference): New function.
(fold_const_aggregate_ref): Use it.
* fold-const.c (canonicalize_constructor_val): Check that we don't fold
into external static.
From-SVN: r164688
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r-- | gcc/gimple-fold.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 8bad08d..b8c0fd4 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -54,12 +54,11 @@ static_object_in_other_unit_p (tree decl) struct varpool_node *vnode; struct cgraph_node *node; - if (!TREE_STATIC (decl) - || TREE_PUBLIC (decl) || DECL_COMDAT (decl)) + if (!TREE_STATIC (decl) || DECL_COMDAT (decl)) return false; /* External flag is set, so we deal with C++ reference to static object from other file. */ - if (DECL_EXTERNAL (decl)) + if (DECL_EXTERNAL (decl) && TREE_CODE (decl) == VAR_DECL) { /* Just be sure it is not big in frontend setting flags incorrectly. Those variables should never @@ -68,6 +67,8 @@ static_object_in_other_unit_p (tree decl) || !vnode->finalized); return true; } + if (TREE_PUBLIC (decl)) + return false; /* We are not at ltrans stage; so don't worry about WHOPR. */ if (!flag_ltrans) return false; |