https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85391

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
With following debug patch:

diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index fa9380cce80..7d14a923b4d 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -1869,7 +1869,7 @@ add_type_duplicate (odr_type val, tree type)
     }
   gcc_assert (val->odr_violated || !odr_must_violate);
   /* Sanity check that all bases will be build same way again.  */
-  if (flag_checking
+  if (true//flag_checking
       && COMPLETE_TYPE_P (type) && COMPLETE_TYPE_P (val->type)
       && TREE_CODE (val->type) == RECORD_TYPE
       && TREE_CODE (type) == RECORD_TYPE
@@ -1884,7 +1884,23 @@ add_type_duplicate (odr_type val, tree type)
        if (polymorphic_type_binfo_p (BINFO_BASE_BINFO
                                         (TYPE_BINFO (type), i)))
          num_poly_bases++;
+
+      if (num_poly_bases != val->bases.length ())
+      {
+       fprintf(stderr, "poly bases: %d\n", num_poly_bases);
+       for (i = 0; i < BINFO_N_BASE_BINFOS (TYPE_BINFO (type)); i++)
+         if (polymorphic_type_binfo_p (BINFO_BASE_BINFO
+                                          (TYPE_BINFO (type), i)))
+           debug_tree(BINFO_BASE_BINFO (TYPE_BINFO (type), i));
+       fprintf(stderr, "val bases: %d\n", val->bases.length ());
+
+       for (unsigned i = 0; i < val->bases.length (); i++)
+           debug_tree(val->bases[i]->type);
+      }
+
+
       gcc_assert (num_poly_bases == val->bases.length ());
+
       for (j = 0, i = 0; i < BINFO_N_BASE_BINFOS (TYPE_BINFO (type));
           i++)
        if (polymorphic_type_binfo_p (BINFO_BASE_BINFO

I see:

poly bases: 2
 <tree_binfo 0x7ffff52aad00
    type <record_type 0x7ffff5666b28 SfxViewShell addressable
needs-constructing BLK
        size <integer_cst 0x7ffff5dd4030 constant 1344>
        unit-size <integer_cst 0x7ffff5dd4060 constant 168>
        align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff5871690
        attributes <tree_list 0x7ffff5d36618
            purpose <identifier_node 0x7ffff5d365f0 visibility>
            value <tree_list 0x7ffff5d365c8
                value <string_cst 0x7ffff69978e0 type <array_type
0x7ffff5d375e8>
                    readonly constant static "default\000">>>
        fields <field_decl 0x7ffff566d390 D.42120 type <record_type
0x7ffff5efc690 SfxShell>
            ignored BLK
/home/marxin/BIG/Programming/libreoffice/include/sfx2/viewsh.hxx:145:22
            size <integer_cst 0x7ffff687a1b0 constant 320>
            unit-size <integer_cst 0x7ffff6994810 constant 40>
            align:64 warn_if_not_align:0 offset_align 128
            offset <integer_cst 0x7ffff67a7c18 constant 0>
            bit-offset <integer_cst 0x7ffff67a7c60 constant 0> context
<record_type 0x7ffff5666b28 SfxViewShell> chain <field_decl 0x7ffff566d2f8
D.42119>> context <translation_unit_decl 0x7ffff58778e8
/home/marxin/BIG/Programming/libreoffice/sc/source/ui/docshell/olinefun.cxx>
        chain <type_decl 0x7ffff566d428 SfxViewShell>>
    bases:4 offset <integer_cst 0x7ffff67a7c18 0>>
 <tree_binfo 0x7ffff5355f08
    type <record_type 0x7ffff56fb5e8 ScDBFunc addressable needs-constructing
BLK
        size <integer_cst 0x7ffff5b2af30 constant 8128>
        unit-size <integer_cst 0x7ffff5bc8708 constant 1016>
        align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff56fb5e8
        fields <field_decl 0x7ffff5382720 _vptr.ScDBFunc type <pointer_type
0x7ffff69a0930>
            unsigned virtual DI
/home/marxin/BIG/Programming/libreoffice/sc/source/ui/inc/dbfunc.hxx:39:0
            size <integer_cst 0x7ffff67a7be8 constant 64>
            unit-size <integer_cst 0x7ffff67a7c00 constant 8>
            align:64 warn_if_not_align:0 offset_align 128
            offset <integer_cst 0x7ffff67a7c18 constant 0>
            bit-offset <integer_cst 0x7ffff67a7c60 constant 0> context
<record_type 0x7ffff56fb5e8 ScDBFunc> chain <field_decl 0x7ffff53827b8
D.52057>> context <translation_unit_decl 0x7ffff5545d98
/home/marxin/BIG/Programming/libreoffice/sc/source/ui/view/dbfunc.cxx>
        chain <type_decl 0x7ffff5382850 ScDBFunc>>
    bases:1 offset <integer_cst 0x7ffff5dd4060 168>>
val bases: 1
 <record_type 0x7ffff5871690 SfxViewShell addressable needs-constructing BLK
    size <integer_cst 0x7ffff5dd4030 type <integer_type 0x7ffff67bb0a8
bitsizetype> constant 1344>
    unit-size <integer_cst 0x7ffff5dd4060 type <integer_type 0x7ffff67bb000
sizetype> constant 168>
    align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff5871690
    attributes <tree_list 0x7ffff5d36618
        purpose <identifier_node 0x7ffff5d365f0 visibility>
        value <tree_list 0x7ffff5d365c8
            value <string_cst 0x7ffff69978e0 type <array_type 0x7ffff5d375e8>
                readonly constant static "default\000">>>
    fields <field_decl 0x7ffff5873688 D.33082
        type <record_type 0x7ffff5efc690 SfxShell addressable
needs-constructing BLK
            size <integer_cst 0x7ffff687a1b0 constant 320>
            unit-size <integer_cst 0x7ffff6994810 constant 40>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff5d490a8 attributes <tree_list 0x7ffff5d36618> fields <field_decl
0x7ffff5efd5f0 D.10874> context <translation_unit_decl 0x7ffff67b1c30
/home/marxin/BIG/Programming/libreoffice/sc/source/core/tool/detfunc.cxx>
            chain <type_decl 0x7ffff5efd688 SfxShell>>
        ignored BLK
/home/marxin/BIG/Programming/libreoffice/include/sfx2/viewsh.hxx:145:22 size
<integer_cst 0x7ffff687a1b0 320> unit-size <integer_cst 0x7ffff6994810 40>
        align:64 warn_if_not_align:0 offset_align 128
        offset <integer_cst 0x7ffff67a7c18 constant 0>
        bit-offset <integer_cst 0x7ffff67a7c60 constant 0> context <record_type
0x7ffff5871690 SfxViewShell>
        chain <field_decl 0x7ffff58735f0 D.33081 type <record_type
0x7ffff5d37690 SfxListener>
            ignored BLK
/home/marxin/BIG/Programming/libreoffice/include/sfx2/viewsh.hxx:145:22
            size <integer_cst 0x7ffff67a7c30 constant 128>
            unit-size <integer_cst 0x7ffff67a7c48 constant 16>
            align:64 warn_if_not_align:0 offset_align 128
            offset <integer_cst 0x7ffff67c3048 constant 32>
            bit-offset <integer_cst 0x7ffff67a7be8 constant 64> context
<record_type 0x7ffff5871690 SfxViewShell> chain <field_decl 0x7ffff5873558
D.33080>>> context <translation_unit_decl 0x7ffff5e6cca8
/home/marxin/BIG/Programming/libreoffice/sc/source/ui/Accessibility/AccessibleCell.cxx>
    chain <type_decl 0x7ffff5873720 SfxViewShell>>

Reply via email to