diff options
author | Jan Hubicka <jh@suse.cz> | 2018-04-10 08:33:38 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2018-04-10 06:33:38 +0000 |
commit | c1b8f25d8090e778b330555005c81bc0c582a6b8 (patch) | |
tree | 7820fbe8f54a1910d5b3f0a145e1fea2b418a3e4 /gcc | |
parent | f518da46fbbdd79ab13417440198110dc9fc96d3 (diff) | |
download | gcc-c1b8f25d8090e778b330555005c81bc0c582a6b8.zip gcc-c1b8f25d8090e778b330555005c81bc0c582a6b8.tar.gz gcc-c1b8f25d8090e778b330555005c81bc0c582a6b8.tar.bz2 |
re PR lto/85078 (LTO ICE: tree check: expected tree that contains 'decl minimal' structure, have 'identifier_node' in decl_mangling_context, at cp/mangle.c:878)
PR lto/85078
* ipa-devirt.c (rebuild_type_inheritance-hash): New.
* ipa-utils.h (rebuild_type_inheritance-hash): Declare.
* tree.c (free_lang_data_in_type): Fix handling of binfos;
walk basetypes.
(free_lang_data): Rebuild type inheritance graph.
* g++.dg/torture/pr85078.C: New.
From-SVN: r259264
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/ipa-devirt.c | 18 | ||||
-rw-r--r-- | gcc/ipa-utils.h | 1 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/torture/pr85078.C | 40 | ||||
-rw-r--r-- | gcc/tree.c | 7 |
6 files changed, 79 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 368db64..0f5a8b2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2018-04-09 Jan Hubicka <jh@suse.cz> + + PR lto/85078 + * ipa-devirt.c (rebuild_type_inheritance-hash): New. + * ipa-utils.h (rebuild_type_inheritance-hash): Declare. + * tree.c (free_lang_data_in_type): Fix handling of binfos; + walk basetypes. + (free_lang_data): Rebuild type inheritance graph. + 2018-04-09 Martin Sebor <msebor@redhat.com> * invoke.texi (-finline-small-functions): Mention other optimization diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index 30d3757..fa9380c 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -2702,6 +2702,24 @@ free_polymorphic_call_targets_hash () } } +/* Force rebuilding type inheritance graph from scratch. + This is use to make sure that we do not keep references to types + which was not visible to free_lang_data. */ + +void +rebuild_type_inheritance_graph () +{ + if (!odr_hash) + return; + delete odr_hash; + if (in_lto_p) + delete odr_vtable_hash; + odr_hash = NULL; + odr_vtable_hash = NULL; + odr_types_ptr = NULL; + free_polymorphic_call_targets_hash (); +} + /* When virtual function is removed, we may need to flush the cache. */ static void diff --git a/gcc/ipa-utils.h b/gcc/ipa-utils.h index 6176189..1609ac1 100644 --- a/gcc/ipa-utils.h +++ b/gcc/ipa-utils.h @@ -55,6 +55,7 @@ bool ipa_propagate_frequency (struct cgraph_node *node); struct odr_type_d; typedef odr_type_d *odr_type; void build_type_inheritance_graph (void); +void rebuild_type_inheritance_graph (void); void update_type_inheritance_graph (void); vec <cgraph_node *> possible_polymorphic_call_targets (tree, HOST_WIDE_INT, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 260150c..85392f6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-04-09 Jan Hubicka <jh@suse.cz> + + PR lto/85078 + * g++.dg/torture/pr85078.C: New. + 2018-04-09 Paolo Carlini <paolo.carlini@oracle.com> PR c++/85227 diff --git a/gcc/testsuite/g++.dg/torture/pr85078.C b/gcc/testsuite/g++.dg/torture/pr85078.C new file mode 100644 index 0000000..de512bd --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr85078.C @@ -0,0 +1,40 @@ +typedef __builtin_va_list a; + +class b +{ +public: + virtual void c (int, const char *, a &); + char d; + void m_fn2 () + { + a a; + c (2, &d, a); + } +}; + +class e:b +{ + virtual void f () + { + } + void c (int, const char *, a &); +}; + +class g +{ +protected: + b h; +}; + +class i:g +{ + int j (); +}; + +int +i::j () +{ + h.m_fn2 (); + return 0; +} + @@ -5521,7 +5521,8 @@ find_decls_types_r (tree *tp, int *ws, void *data) tree tem; FOR_EACH_VEC_ELT (*BINFO_BASE_BINFOS (TYPE_BINFO (t)), i, tem) fld_worklist_push (TREE_TYPE (tem), fld); - fld_worklist_push (BINFO_VIRTUALS (TYPE_BINFO (t)), fld); + fld_worklist_push (BINFO_TYPE (TYPE_BINFO (t)), fld); + fld_worklist_push (BINFO_VTABLE (TYPE_BINFO (t)), fld); } if (RECORD_OR_UNION_TYPE_P (t)) { @@ -5540,6 +5541,8 @@ find_decls_types_r (tree *tp, int *ws, void *data) tem = TREE_CHAIN (tem); } } + if (FUNC_OR_METHOD_TYPE_P (t)) + fld_worklist_push (TYPE_METHOD_BASETYPE (t), fld); fld_worklist_push (TYPE_STUB_DECL (t), fld); *ws = 0; @@ -5859,6 +5862,8 @@ free_lang_data (void) /* Reset diagnostic machinery. */ tree_diagnostics_defaults (global_dc); + rebuild_type_inheritance_graph (); + return 0; } |