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

Aldy Hernandez <aldyh at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-12-06

--- Comment #2 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
The dispatch code in range_op_handler::fold_range() is ICEing because LHS is an
irange, whereas op1 is an unsupported type:

(gdb) p debug(r)
[irange] UNDEFINED
(gdb) p debug(lh)
[unsupported_range] UNDEFINED

Going up to range_of_range_op we see:

(gdb) up
#3  0x0000000002ec054f in fold_using_range::range_of_range_op
(this=0x7fffffffcb7f, r=warning: RTTI symbol not found for class
'int_range<255u>'
..., handler=..., src=...) at /home/aldyh/src/gcc/gcc/gimple-range-fold.cc:565
(gdb) p debug(s)
pfd.0_1 = (sizetype) pfb_5;

(gdb) p debug_tree(lhs)
 <ssa_name 0x7fffe9fc40d8
    type <integer_type 0x7fffe9e26000 sizetype public unsigned DI
        size <integer_cst 0x7fffe9e02fc0 constant 64>
        unit-size <integer_cst 0x7fffe9e02fd8 constant 8>
        align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fffe9e26000 precision:64 min <integer_cst 0x7fffe9e28000 0> max <integer_cst
0x7fffe9e035e0 18446744073709551615>>
    visited
    def_stmt pfd.0_1 = (sizetype) pfb_5;
    version:1>
$7 = void
(gdb) p debug_tree(op1)
 <ssa_name 0x7fffe9fc41f8
    type <offset_type 0x7fffe9fca150
        type <integer_type 0x7fffe9e265e8 int sizes-gimplified public type_6 SI
            size <integer_cst 0x7fffe9e28210 constant 32>
            unit-size <integer_cst 0x7fffe9e28228 constant 4>
            align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fffe9e265e8 precision:32 min <integer_cst 0x7fffe9e281c8 -2147483648> max
<integer_cst 0x7fffe9e281e0 2147483647>
            pointer_to_this <pointer_type 0x7fffe9e2eb28>>
        sizes-gimplified public DI
        size <integer_cst 0x7fffe9e02fc0 constant 64>
        unit-size <integer_cst 0x7fffe9e02fd8 constant 8>
        align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fffe9fca150 basetype <record_type 0x7fffe9fae7e0 B>>
    visited var <var_decl 0x7fffe9e11d80 pfb>
    def_stmt pfb_5 = 0;
    version:5>
$8 = void

So we're trying to cast from an offset_type (unsupported) to an integer_type
(irange).  It looks like range_op_handler should have set m_valid to false for
this combination, but m_valid is set from set_op_handler() which only looks at
the LHS.

Reply via email to