re PR c++/62302 (Change in the comdat used for constructors)
authorJason Merrill <jason@redhat.com>
Sun, 31 Aug 2014 21:06:08 +0000 (17:06 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Sun, 31 Aug 2014 21:06:08 +0000 (17:06 -0400)
PR c++/62302
* optimize.c (cdtor_comdat_group): Just look at the
DECL_ASSEMBLER_NAME of the 'tors.

From-SVN: r214770

gcc/cp/ChangeLog
gcc/cp/optimize.c
gcc/testsuite/g++.dg/abi/comdat1.C [new file with mode: 0644]

index 2f7cc664f3d06c092d33b80e9d1d07fa5637aa02..58890b47248473a4c1ef5bdc8f68aa7f676090f4 100644 (file)
@@ -1,3 +1,9 @@
+2014-08-31  Jason Merrill  <jason@redhat.com>
+
+       PR c++/62302
+       * optimize.c (cdtor_comdat_group): Just look at the
+       DECL_ASSEMBLER_NAME of the 'tors.
+
 2014-08-27  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/52892
index f9a236e84277bb3666f25b7da80fac5e3323c77a..31acb073185bcfac925478503fcd25a10d33f09b 100644 (file)
@@ -159,18 +159,12 @@ build_delete_destructor_body (tree delete_dtor, tree complete_dtor)
 static tree
 cdtor_comdat_group (tree complete, tree base)
 {
-  tree complete_name = DECL_COMDAT_GROUP (complete);
-  tree base_name = DECL_COMDAT_GROUP (base);
+  tree complete_name = DECL_ASSEMBLER_NAME (complete);
+  tree base_name = DECL_ASSEMBLER_NAME (base);
   char *grp_name;
   const char *p, *q;
   bool diff_seen = false;
   size_t idx;
-  if (complete_name == NULL)
-    complete_name = cxx_comdat_group (complete);
-  if (base_name == NULL)
-    base_name = cxx_comdat_group (base);
-  complete_name = DECL_ASSEMBLER_NAME (complete_name);
-  base_name = DECL_ASSEMBLER_NAME (base_name);
   gcc_assert (IDENTIFIER_LENGTH (complete_name)
              == IDENTIFIER_LENGTH (base_name));
   grp_name = XALLOCAVEC (char, IDENTIFIER_LENGTH (complete_name) + 1);
@@ -190,7 +184,7 @@ cdtor_comdat_group (tree complete, tree base)
        diff_seen = true;
       }
   grp_name[idx] = '\0';
-  gcc_assert (diff_seen || symtab_node::get (complete)->alias);
+  gcc_assert (diff_seen);
   return get_identifier (grp_name);
 }
 
diff --git a/gcc/testsuite/g++.dg/abi/comdat1.C b/gcc/testsuite/g++.dg/abi/comdat1.C
new file mode 100644 (file)
index 0000000..e1025e3
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/62302
+
+// { dg-do compile { target *-*-*gnu* } }
+// { dg-final { scan-assembler "_ZN3optIiED5Ev,comdat" } }
+// { dg-final { scan-assembler-not "_ZN3optIiED0Ev,comdat" } }
+// { dg-final { scan-assembler-not "_ZN3optIiED1Ev,comdat" } }
+// { dg-final { scan-assembler-not "_ZN3optIiED2Ev,comdat" } }
+
+struct Option {
+  virtual ~Option() {}
+};
+template <class DataType> class opt : public Option {};
+template class opt<int>;