This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix for PR64330
- From: Martin LiÅka <mliska at suse dot cz>
- To: "gcc-pa >> GCC Patches" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 18 Dec 2014 14:29:27 +0100
- Subject: [PATCH] Fix for PR64330
- Authentication-results: sourceware.org; auth=none
Hello.
Following patch is fix for PR64330, is pre-approved by Honza and I'm going to install it.
No regression was seen on x86_64-linux-pc.
Thanks,
Martin
>From 6f9ed17a2897be6a26e2c64f8e581771c216e41b Mon Sep 17 00:00:00 2001
From: mliska <mliska@suse.cz>
Date: Wed, 17 Dec 2014 19:11:48 +0100
Subject: [PATCH] Fix for PR64330.
gcc/ChangeLog:
2014-12-17 Martin Liska <mliska@suse.cz>
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.
---
gcc/ipa-icf.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index b193200..ad106e5 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -1131,10 +1131,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);
--
2.1.2