From: marxin Date: Thu, 18 Dec 2014 13:32:18 +0000 (+0000) Subject: Fix for PR64330. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4ada17e5ea23421b2a8e58850a34602b4ea485c1;p=thirdparty%2Fgcc.git Fix for PR64330. PR tree-optimization/64330 * ipa-icf.c (sem_variable::parse): Add checking for externally visible symbols and do not introduce an alias for an external declaration. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218864 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7b85cbc751b4..1bb694447174 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2014-12-18 Martin Liska + + PR tree-optimization/64330 + * ipa-icf.c (sem_variable::parse): Add checking + for externally visible symbols and do not introduce + an alias for an external declaration. + 2014-12-18 Jan Hubicka PR bootstrap/63573 diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c index 91878b2d3fce..244edaa1bc4b 100644 --- a/gcc/ipa-icf.c +++ b/gcc/ipa-icf.c @@ -1139,10 +1139,14 @@ sem_variable::parse (varpool_node *node, bitmap_obstack *stack) tree decl = node->decl; bool readonly = TYPE_P (decl) ? TYPE_READONLY (decl) : TREE_READONLY (decl); - bool can_handle = readonly && (DECL_VIRTUAL_P (decl) - || !TREE_ADDRESSABLE (decl)); + if (!readonly) + return NULL; + + bool can_handle = DECL_VIRTUAL_P (decl) + || flag_merge_constants >= 2 + || (!TREE_ADDRESSABLE (decl) && !node->externally_visible); - if (!can_handle) + if (!can_handle || DECL_EXTERNAL (decl)) return NULL; tree ctor = ctor_for_folding (decl);