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

--- Comment #1 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Ok, we die testing:

3199              if (!useless_type_conversion_p (TREE_TYPE (expr),
3200                                              TREE_TYPE (TREE_OPERAND
(expr, 1))))


where expr is:
 <component_ref 0x7ffff7231a80
    type <array_type 0x7ffff72333f0
        type <pointer_type 0x7ffff72330a8 type <record_type 0x7ffff720fdc8 a>
            public unsigned DI
            size <integer_cst 0x7ffff70e7c90 constant 64>
            unit-size <integer_cst 0x7ffff70e7ca8 constant 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff7233150>
        BLK
        size <integer_cst 0x7ffff70e7d08 constant 0>
        unit-size <integer_cst 0x7ffff70e7cc0 constant 0>
        align:64 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality
        domain <integer_type 0x7ffff72331f8 type <integer_type 0x7ffff7100000
sizetype>
            DI size <integer_cst 0x7ffff70e7c90 64> unit-size <integer_cst
0x7ffff70e7ca8 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff72331f8 precision:64 min <integer_cst 0x7ffff70e7cc0 0>>>

    arg:0 <mem_ref 0x7ffff7211898
        type <record_type 0x7ffff7233498 c type_0 BLK size <integer_cst
0x7ffff70e7d08 0> unit-size <integer_cst 0x7ffff70e7cc0 0>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff7233000 fields <field_decl 0x7ffff710f428 b> context
<translation_unit_decl 0x7ffff70f4c30 ice.i>
            pointer_to_this <pointer_type 0x7ffff7233690>>

        arg:0 <ssa_name 0x7ffff70f1cf0 type <pointer_type 0x7ffff7233690>

            def_stmt _1 = 0B;
            version:1>
        arg:1 <integer_cst 0x7ffff7219cc0 constant 0>
        ice.i:8:20 start: ice.i:8:20 finish: ice.i:8:21>
    arg:1 <field_decl 0x7ffff710f428 b
        type <array_type 0x7ffff7233b28 type <pointer_type 0x7ffff7233a80>
            BLK
            align:64 warn_if_not_align:0 symtab:0 alias-set -1
structural-equality domain <integer_type 0x7ffff72331f8>>
        BLK ice.i:5:6 size <integer_cst 0x7ffff70e7d08 0> unit-size
<integer_cst 0x7ffff70e7cc0 0>
        align:64 warn_if_not_align:0 offset_align 128 offset <integer_cst
0x7ffff70e7cc0 0> bit-offset <integer_cst 0x7ffff70e7d08 0> context
<record_type 0x7ffff7233000>>
    ice.i:8:20 start: ice.i:8:12 finish: ice.i:8:22>


now component_ref has unsimplified array type while field_decl has simplified
type. useless_type_conversion now consider them as incomparable at:
174               && (!TYPE_SIZE (inner_type)
175                   || TREE_CODE (TYPE_SIZE (inner_type)) != INTEGER_CST
176                   || !tree_int_cst_equal (TYPE_SIZE (outer_type),
177                                           TYPE_SIZE (inner_type))))

here inner_type is:
 <array_type 0x7ffff7233b28
    type <pointer_type 0x7ffff7233a80
        type <record_type 0x7ffff72339d8 a type_0 VOID
            align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff720fd20 context <translation_unit_decl 0x7ffff70f4c30 ice.i>
            pointer_to_this <pointer_type 0x7ffff7233a80>>
        unsigned DI
        size <integer_cst 0x7ffff70e7c90 constant 64>
        unit-size <integer_cst 0x7ffff70e7ca8 constant 8>
        align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff7233150>
    BLK
    align:64 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality
    domain <integer_type 0x7ffff72331f8
        type <integer_type 0x7ffff7100000 sizetype public unsigned DI size
<integer_cst 0x7ffff70e7c90 64> unit-size <integer_cst 0x7ffff70e7ca8 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff7100000 precision:64 min <integer_cst 0x7ffff70e7cc0 0> max <integer_cst
0x7ffff70e84c0 18446744073709551615>>
        DI size <integer_cst 0x7ffff70e7c90 64> unit-size <integer_cst
0x7ffff70e7ca8 8>
        align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff72331f8 precision:64 min <integer_cst 0x7ffff70e7cc0 0>>>

while outer_type is:
 <array_type 0x7ffff72333f0
    type <pointer_type 0x7ffff72330a8
        type <record_type 0x7ffff720fdc8 a type_0 BLK
            size <integer_cst 0x7ffff70e7d08 constant 0>
            unit-size <integer_cst 0x7ffff70e7cc0 constant 0>
            align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff720fd20 context <translation_unit_decl 0x7ffff70f4c30 ice.i>
            pointer_to_this <pointer_type 0x7ffff72330a8>>
        public unsigned DI
        size <integer_cst 0x7ffff70e7c90 constant 64>
        unit-size <integer_cst 0x7ffff70e7ca8 constant 8>
        align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff7233150>
    BLK size <integer_cst 0x7ffff70e7d08 0> unit-size <integer_cst
0x7ffff70e7cc0 0>
    align:64 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality
    domain <integer_type 0x7ffff72331f8
        type <integer_type 0x7ffff7100000 sizetype public unsigned DI size
<integer_cst 0x7ffff70e7c90 64> unit-size <integer_cst 0x7ffff70e7ca8 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff7100000 precision:64 min <integer_cst 0x7ffff70e7cc0 0> max <integer_cst
0x7ffff70e84c0 18446744073709551615>>
        DI size <integer_cst 0x7ffff70e7c90 64> unit-size <integer_cst
0x7ffff70e7ca8 8>
        align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff72331f8 precision:64 min <integer_cst 0x7ffff70e7cc0 0>>>

so outer_type is more specified and thus I guess it is correctly not useless
conversion though I do not see how operations on those arrays can diverge?

Reply via email to