ipa.c (comdat_can_be_unshared_p_1): C++ constructors and destructors can be unshared.
authorJan Hubicka <jh@suse.cz>
Mon, 26 Aug 2013 15:38:33 +0000 (17:38 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Mon, 26 Aug 2013 15:38:33 +0000 (15:38 +0000)
* ipa.c (comdat_can_be_unshared_p_1): C++ constructors and destructors
can be unshared.

From-SVN: r202001

gcc/ChangeLog
gcc/ipa.c

index c41ad229d9dcc7fe6296535fb7157fe21e9b075c..19ddd93e036e17f1259b8231535d2aa65d4bcd87 100644 (file)
@@ -1,3 +1,8 @@
+2013-08-26  Jan Hubicka  <jh@suse.cz>
+
+       * ipa.c (comdat_can_be_unshared_p_1): C++ constructors and destructors
+       can be unshared.
+
 2013-08-26  Joern Rennecke  <joern.rennecke@embecosm.com>
 
        * reload.c (find_valid_class): Allow classes that do not include
index 370032b84e71541b2b1eebc15be224ee10339058..778a88fcbdfb1ac3697999f0225b2f64053be89d 100644 (file)
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -574,9 +574,13 @@ static bool
 comdat_can_be_unshared_p_1 (symtab_node node)
 {
   /* When address is taken, we don't know if equality comparison won't
-     break eventually. Exception are virutal functions and vtables,
-     where this is not possible by language standard.  */
+     break eventually. Exception are virutal functions, C++
+     constructors/destructors and vtables, where this is not possible by
+     language standard.  */
   if (!DECL_VIRTUAL_P (node->symbol.decl)
+      && (TREE_CODE (node->symbol.decl) != FUNCTION_DECL
+         || (!DECL_CXX_CONSTRUCTOR_P (node->symbol.decl)
+             && !DECL_CXX_DESTRUCTOR_P (node->symbol.decl)))
       && address_taken_from_non_vtable_p (node))
     return false;