http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55683



--- Comment #11 from Jan Hubicka <hubicka at gcc dot gnu.org> 2012-12-18 
17:15:51 UTC ---

Created attachment 29001

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29001

proposed patch



OK,

we know the argument is constant

 <addr_expr 0x7ffff7585700

    type <pointer_type 0x7ffff75741f8

        type <record_type 0x7ffff7560f18 C sizes-gimplified addressable

needs-constructing type_1 type_5 BLK

            size <integer_cst 0x7ffff73f7e40 constant 128>

            unit size <integer_cst 0x7ffff73f7e60 constant 16>

            align 64 symtab 0 alias set 4 canonical type 0x7ffff7560f18 fields

<field_decl 0x7ffff755ca18 c2> context <translation_unit_decl 0x7ffff7410170

D.1>

            full-name "struct C"

            needs-constructor X() X(constX&) this=(X&) n_parents=0

use_template=0 interface-unknown

            pointer_to_this <pointer_type 0x7ffff75741f8> chain <type_decl

0x7ffff755aac8 C>>

        public unsigned DI

        size <integer_cst 0x7ffff73f7dc0 constant 64>

        unit size <integer_cst 0x7ffff73f7de0 constant 8>

        align 64 symtab 0 alias set -1 canonical type 0x7ffff75741f8>

    constant

    arg 0 <var_decl 0x7ffff755cda8 c type <record_type 0x7ffff7560f18 C>

        addressable used static tree_1 tree_3 decl_5 decl_6 BLK file t.C line

25 col 12 size <integer_cst 0x7ffff73f7e40 128> unit size <integer_cst

0x7ffff73f7e60 16>

        align 128 context <function_decl 0x7ffff7576900 bar>>>



ipa_get_indirect_edge_target used when we estimate effect of inlining goes into

path looking up the binfo based on constant



  if (TREE_CODE (t) != TREE_BINFO)

    { 

      tree binfo;

      binfo = gimple_extract_devirt_binfo_from_cst (t);

      if (!binfo)

        return NULL_TREE;

      binfo = get_binfo_at_offset (binfo, anc_offset, otr_type);

      if (!binfo)

        return NULL_TREE;

      return gimple_get_virt_method_for_binfo (token, binfo);

    }



this code is missing in try_make_edge_direct_virtual_call that is actually

responsible for devirtualizing.  I am testing the attached patch.



If I read this right, we should get the problem every time we devirtualize

based on static object.  I am surprised this do not trigger in

testsuite/bootstrap.



Honza

Reply via email to