Created attachment 34989 [details] one.ii Follow up to PR65276, PR65302 and PR65316, still for the same program - but I have the feeling, we are slowly getting there. The real-program's message is slightly different (get_odr_type, at ipa-devirt.c:1704). g++ -c -std=c++11 -flto -O2 two.ii one.ii gcc -r -nostdlib two.o one.o one.ii:66:21: warning: type ‘struct ctype’ violates one definition rule [-Wodr] template <> class ctype < char > ^ two.ii:51:21: note: a type with the same name but different number of polymorphic bases is defined in another translation unit template <> class ctype < char >:public locale::facet, public ctype_base ^ lto1: internal compiler error: tree check: expected tree that contains ‘decl minimal’ structure, have ‘tree_binfo’ in add_type_duplicate, at ipa-devirt.c:1509 0xca3d94 tree_contains_struct_check_failed(tree_node const*, tree_node_structure_enum, char const*, int, char const*) ../../gcc/tree.c:9468 0x8948ec contains_struct_check(tree_node*, tree_node_structure_enum, char const*, int, char const*) ../../gcc/tree.h:2960 0x8948ec add_type_duplicate ../../gcc/ipa-devirt.c:1508 0x8948ec get_odr_type(tree_node*, bool) ../../gcc/ipa-devirt.c:1763 0x89694f register_odr_type(tree_node*) ../../gcc/ipa-devirt.c:1839
Created attachment 34990 [details] two.ii
Confirmed.
Created attachment 34993 [details] gcc5-pr65361.patch Untested fix. Now to create a smaller testcase.
--- gcc/testsuite/g++.dg/lto/pr65361_0.C.jj 2015-03-09 16:43:42.720534781 +0100 +++ gcc/testsuite/g++.dg/lto/pr65361_0.C 2015-03-09 16:47:00.325356410 +0100 @@ -0,0 +1,6 @@ +// { dg-lto-do link { xfail } } +// { dg-lto-options { { -flto -O2 } } } +// { dg-extra-ld-options "-r -nostdlib -O2" } + +struct A { A () {} virtual ~A () {} }; +A a; --- gcc/testsuite/g++.dg/lto/pr65361_1.C.jj 2015-03-09 16:43:45.981482330 +0100 +++ gcc/testsuite/g++.dg/lto/pr65361_1.C 2015-03-09 16:39:00.000000000 +0100 @@ -0,0 +1,3 @@ +struct B {}; +struct A : public B { A () {} virtual ~A () {} }; +A b; reproduces this, but unfortunately lto.exp doesn't support link failures, nor error messages out of lto1 during the linking. So I'm afraid we need to live without a testcase for now. BTW, I see several spots with __attribute__((visibility ("default"))) on std namespace in g++.dg/lto/, bet that is undesirable if some target would support LTO, but not visibilities.
(In reply to Jakub Jelinek from comment #3) > Untested fix Thanks! It looks good for the the original two unreduced files. Also, I have finally been able again to compile the full code (at least with some option variants). For another variant, I still get an ICE (in add_symbol_to_partition_1, at lto/lto-partition.c:158) after 64min of compiling, which I will try to reduce now.
Author: jakub Date: Mon Mar 9 20:19:34 2015 New Revision: 221286 URL: https://gcc.gnu.org/viewcvs?rev=221286&root=gcc&view=rev Log: PR lto/65361 * ipa-devirt.c (add_type_duplicate): Don't use DECL_CONTEXT on a TREE_BINFO, instead use BINFO_TYPE. Modified: trunk/gcc/ChangeLog trunk/gcc/ipa-devirt.c
Fixed.