Bug 65361 - [5 Regression] LTO: tree check: expected tree that contains ‘decl minimal’ structure, have ‘tree_binfo’ in add_type_duplicate, at ipa-devirt.c:1509
Summary: [5 Regression] LTO: tree check: expected tree that contains ‘decl minimal’ st...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: lto (show other bugs)
Version: 5.0
: P3 normal
Target Milestone: 5.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-09 12:46 UTC by Tobias Burnus
Modified: 2015-03-09 20:20 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-03-09 00:00:00


Attachments
one.ii (759 bytes, text/plain)
2015-03-09 12:46 UTC, Tobias Burnus
Details
two.ii (688 bytes, text/plain)
2015-03-09 12:47 UTC, Tobias Burnus
Details
gcc5-pr65361.patch (421 bytes, patch)
2015-03-09 15:33 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2015-03-09 12:46:51 UTC
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
Comment 1 Tobias Burnus 2015-03-09 12:47:13 UTC
Created attachment 34990 [details]
two.ii
Comment 2 Marek Polacek 2015-03-09 14:36:29 UTC
Confirmed.
Comment 3 Jakub Jelinek 2015-03-09 15:33:26 UTC
Created attachment 34993 [details]
gcc5-pr65361.patch

Untested fix.  Now to create a smaller testcase.
Comment 4 Jakub Jelinek 2015-03-09 16:01:43 UTC
--- 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.
Comment 5 Tobias Burnus 2015-03-09 16:27:12 UTC
(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.
Comment 6 Jakub Jelinek 2015-03-09 20:20:06 UTC
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
Comment 7 Jakub Jelinek 2015-03-09 20:20:56 UTC
Fixed.