Commit cbb4d6a4 by Jason Merrill Committed by Jason Merrill

re PR c++/62302 (Change in the comdat used for constructors)

	PR c++/62302
	* optimize.c (cdtor_comdat_group): Just look at the
	DECL_ASSEMBLER_NAME of the 'tors.

From-SVN: r214770
parent a3e3f116
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> 2014-08-27 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/52892 PR c++/52892
......
...@@ -159,18 +159,12 @@ build_delete_destructor_body (tree delete_dtor, tree complete_dtor) ...@@ -159,18 +159,12 @@ build_delete_destructor_body (tree delete_dtor, tree complete_dtor)
static tree static tree
cdtor_comdat_group (tree complete, tree base) cdtor_comdat_group (tree complete, tree base)
{ {
tree complete_name = DECL_COMDAT_GROUP (complete); tree complete_name = DECL_ASSEMBLER_NAME (complete);
tree base_name = DECL_COMDAT_GROUP (base); tree base_name = DECL_ASSEMBLER_NAME (base);
char *grp_name; char *grp_name;
const char *p, *q; const char *p, *q;
bool diff_seen = false; bool diff_seen = false;
size_t idx; 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) gcc_assert (IDENTIFIER_LENGTH (complete_name)
== IDENTIFIER_LENGTH (base_name)); == IDENTIFIER_LENGTH (base_name));
grp_name = XALLOCAVEC (char, IDENTIFIER_LENGTH (complete_name) + 1); grp_name = XALLOCAVEC (char, IDENTIFIER_LENGTH (complete_name) + 1);
...@@ -190,7 +184,7 @@ cdtor_comdat_group (tree complete, tree base) ...@@ -190,7 +184,7 @@ cdtor_comdat_group (tree complete, tree base)
diff_seen = true; diff_seen = true;
} }
grp_name[idx] = '\0'; grp_name[idx] = '\0';
gcc_assert (diff_seen || symtab_node::get (complete)->alias); gcc_assert (diff_seen);
return get_identifier (grp_name); return get_identifier (grp_name);
} }
......
// 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>;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment