https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70594
--- Comment #48 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 38271 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38271&action=edit gcc6-pr70594.patch Untested fix. So the other issue is that noncall_stmt_may_be_vtbl_ptr_store looks for BLOCKs with block_ultimate_origin of FUNCTION_DECL (which is correct), and tree-ssa-live.c was doing that too for finding the cdtor BLOCKs (through inlined_polymorphic_ctor_dtor_block_p), but only looked if BLOCK_ABSTRACT_ORIGIN is FUNCTION_DECL inside of those blocks, which is wrong, that is just subset of what block_ultimate_origin returns. As for the changes I've mentioned in the previous comment already and that are included in this patch too, the thing is that while the pruning code works (except for the above mentioned thing) right when we have a cdtor inlined and some other function inlined into it, we can actually lose the needed BLOCKs already earlier, when pruning unused BLOCKs inside of the cdtor itself before it is inlined - then we also have to avoid pruning the BLOCKs with FUNCTION_DECL ultimate origins (except we of course can prune such blocks inside of BLOCKs with FUNCTION_DECL ultimate origins), thus we need to start with the right value of the is_ctor_dtor_block flag - DECL_INITIAL (current_function_block) usually doesn't have block_ultimate_origin a FUNCTION_DECL and even if it does, it is not current_function_decl - only BLOCK_SUPERCONTEXT (DECL_INITIAL (current_function_decl)) is current_function_decl. This patch fixes the -fcompare-debug issue on the Tobias' testcase.