$ g++ -O -finline-small-functions dtor5.C $ ./a.out Aborted Tested revisions: r165058 - fail r159696 - fail r158095 - OK 4.5 r163761 - OK
Created attachment 21987 [details] simpler testcase I hope the testcase is valid and the behaviour is defined. Needs only -O to reproduce. $ g++ pr45934.C $ ./a.out $ g++ -O pr45934.C $ ./a.out Aborted
Confirmed. This is another de-virtualization issue.
It is in the end similar to PR45734 as the object gets piecewise destructed, changing its effective type. Jason?
This testcase is valid. The effective type of an object for virtual dispatch changes during the construction/destruction process; see 12.7 in the standard. So in addition to the static type of the object, the devirtualizer needs to know when a subobject is under construction or destruction.
Mine.
Patch posted to the mailing list: http://gcc.gnu.org/ml/gcc-patches/2010-11/msg02296.html
I have re-posted the patch series to address this: http://gcc.gnu.org/ml/gcc-patches/2010-12/msg01213.html
Author: jamborm Date: Wed Dec 22 12:56:54 2010 New Revision: 168168 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168168 Log: 2010-12-22 Martin Jambor <mjambor@suse.cz> PR tree-optimization/45934 PR tree-optimization/46302 PR tree-optimization/46987 * gimple-fold.c (get_base_binfo_for_type): Removed. (gimple_get_relevant_ref_binfo): Likewise. (gimple_fold_obj_type_ref_call): Dumb down to 4.5 functionality, removed parameter inplace, updated the caller. * gimple.h (gimple_get_relevant_ref_binfo): Remove declaration. * ipa-cp.c (ipcp_propagate_types): Do not derive types from constants. (ipcp_discover_new_direct_edges): Do not do devirtualization based on constants. * ipa-prop.c (compute_known_type_jump_func): Use get_ref_base_and_extent and get_binfo_at_offset instead of gimple_get_relevant_ref_binfo. (compute_known_type_jump_func): Likewise. (update_jump_functions_after_inlining): Do not derive types from constants. (try_make_edge_direct_virtual_call): Likewise. * tree.c (get_binfo_at_offset): Get type from non-artificial fields. * testsuite/g++.dg/ipa/ipcp-ivi-1.C: Removed. * testsuite/g++.dg/ipa/ivinline-6.C: Likewise. * testsuite/g++.dg/otr-fold-1.C: Likewise. * testsuite/g++.dg/otr-fold-2.C: Likewise. * testsuite/g++.dg/tree-ssa/pr43411.C: Xfail dump scan. * testsuite/g++.dg/tree-ssa/pr45605.C: Likewise. * testsuite/g++.dg/tree-ssa/pr46987.C: New test. Added: trunk/gcc/testsuite/g++.dg/tree-ssa/pr46987.C Removed: trunk/gcc/testsuite/g++.dg/ipa/ipcp-ivi-1.C trunk/gcc/testsuite/g++.dg/ipa/ivinline-6.C trunk/gcc/testsuite/g++.dg/otr-fold-1.C trunk/gcc/testsuite/g++.dg/otr-fold-2.C Modified: trunk/gcc/ChangeLog trunk/gcc/gimple-fold.c trunk/gcc/gimple.h trunk/gcc/ipa-cp.c trunk/gcc/ipa-prop.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/tree-ssa/pr43411.C trunk/gcc/testsuite/g++.dg/tree-ssa/pr45605.C trunk/gcc/tree.c
This still needs at least the following patch in the series (http://gcc.gnu.org/ml/gcc-patches/2010-12/msg01215.html) in order to be considered fixed.
Author: jamborm Date: Fri Jan 14 23:00:59 2011 New Revision: 168825 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168825 Log: 2011-01-14 Martin Jambor <mjambor@suse.cz> PR tree-optimization/45934 PR tree-optimization/46302 * ipa-prop.c (type_change_info): New type. (stmt_may_be_vtbl_ptr_store): New function. (check_stmt_for_type_change): Likewise. (detect_type_change): Likewise. (detect_type_change_ssa): Likewise. (compute_complex_assign_jump_func): Check for dynamic type change. (compute_complex_ancestor_jump_func): Likewise. (compute_known_type_jump_func): Likewise. (compute_scalar_jump_functions): Likewise. (ipa_analyze_virtual_call_uses): Likewise. (ipa_analyze_node): Push and pop cfun, set current_function_decl. * testsuite/g++.dg/ipa/devirt-c-1.C: New test. * testsuite/g++.dg/ipa/devirt-c-2.C: Likewise. * testsuite/g++.dg/ipa/devirt-c-3.C: Likewise. * testsuite/g++.dg/ipa/devirt-c-4.C: Likewise. * testsuite/g++.dg/ipa/devirt-c-5.C: Likewise. * testsuite/g++.dg/ipa/devirt-c-6.C: Likewise. * testsuite/g++.dg/ipa/devirt-6.C: Likewise. * testsuite/g++.dg/ipa/devirt-d-1.C: Likewise. * testsuite/g++.dg/torture/pr45934.C: Likewise. Added: trunk/gcc/testsuite/g++.dg/ipa/devirt-6.C trunk/gcc/testsuite/g++.dg/ipa/devirt-c-1.C trunk/gcc/testsuite/g++.dg/ipa/devirt-c-2.C trunk/gcc/testsuite/g++.dg/ipa/devirt-c-3.C trunk/gcc/testsuite/g++.dg/ipa/devirt-c-4.C trunk/gcc/testsuite/g++.dg/ipa/devirt-c-5.C trunk/gcc/testsuite/g++.dg/ipa/devirt-c-6.C trunk/gcc/testsuite/g++.dg/ipa/devirt-d-1.C trunk/gcc/testsuite/g++.dg/torture/pr45934.C Modified: trunk/gcc/ChangeLog trunk/gcc/ipa-prop.c trunk/gcc/testsuite/ChangeLog
Fixed now?
It is.