diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2019-03-19 15:53:43 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2019-03-19 14:53:43 +0000 |
commit | 2ca6d1813e47d235bb5f001b1a99b19652ea408a (patch) | |
tree | b13250450205e19610d8556959467ff737bb3610 /gcc/tree.c | |
parent | 9195aa172bbc20627f23bfb1612180c83a0a7bab (diff) | |
download | gcc-2ca6d1813e47d235bb5f001b1a99b19652ea408a.zip gcc-2ca6d1813e47d235bb5f001b1a99b19652ea408a.tar.gz gcc-2ca6d1813e47d235bb5f001b1a99b19652ea408a.tar.bz2 |
re PR lto/87089 (tree check: expected class 'type', have 'declaration' (namespace_decl) in type_with_linkage_p, at ipa-utils.h)
PR lto/87809
PR lto/89335
* tree.c (free_lang_data_in_decl): Do not free context of C++
destrutors.
* g++.dg/lto/pr87089_0.C: New testcase.
* g++.dg/lto/pr87089_1.C: New testcase.
* g++.dg/lto/pr89335_0.C: New testcase.
From-SVN: r269799
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -5772,10 +5772,16 @@ free_lang_data_in_decl (tree decl, struct free_lang_data_d *fld) not do well with TREE_CHAIN pointers linking them. Also do not drop containing types for virtual methods and tables because - these are needed by devirtualization. */ + these are needed by devirtualization. + C++ destructors are special because C++ frontends sometimes produces + virtual destructor as an alias of non-virtual destructor. In + devirutalization code we always walk through aliases and we need + context to be preserved too. See PR89335 */ if (TREE_CODE (decl) != FIELD_DECL && ((TREE_CODE (decl) != VAR_DECL && TREE_CODE (decl) != FUNCTION_DECL) - || !DECL_VIRTUAL_P (decl))) + || (!DECL_VIRTUAL_P (decl) + && (TREE_CODE (decl) != FUNCTION_DECL + || !DECL_CXX_DESTRUCTOR_P (decl))))) DECL_CONTEXT (decl) = fld_decl_context (DECL_CONTEXT (decl)); } |