On 07/15/2014 04:46 AM, Jan Hubicka wrote:
I think we still want to check that the local comdats are linked into the corresponding comdat group, so we probably want to test node->definition instead of node->public, or perhaps just clear COMDAT_GROUP info when removing symbol?
Like this?
commit deb1a9e023d457c88edf52231d32af5ef03179f4 Author: Jason Merrill <ja...@redhat.com> Date: Mon Jul 14 16:58:57 2014 -0400 PR c++/61623 * symtab.c (symtab_remove_from_same_comdat_group): Also set_comdat_group to NULL_TREE. (verify_symtab): Fix diagnostic. diff --git a/gcc/symtab.c b/gcc/symtab.c index 3a59935..0050573 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -314,6 +314,7 @@ symtab_remove_from_same_comdat_group (symtab_node *node) else prev->same_comdat_group = node->same_comdat_group; node->same_comdat_group = NULL; + node->set_comdat_group (NULL_TREE); } } @@ -1217,7 +1218,7 @@ verify_symtab (void) { error ("Two symbols with same comdat_group are not linked by the same_comdat_group list."); dump_symtab_node (stderr, *entry); - dump_symtab_node (stderr, s); + dump_symtab_node (stderr, node); internal_error ("verify_symtab failed"); } } diff --git a/gcc/testsuite/g++.dg/opt/declone2.C b/gcc/testsuite/g++.dg/opt/declone2.C new file mode 100644 index 0000000..e725d8e --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/declone2.C @@ -0,0 +1,10 @@ +// PR c++/61623 +// { dg-options "-Os" } + +struct C {}; +struct B : virtual C {}; +struct A : B { + A (int) {} +}; + +A a (0);