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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |tree-optimization
           Priority|P3                          |P2
                 CC|                            |liuhongt at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Target Milestone|---                         |16.3
   Last reconfirmed|                            |2026-09-14

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
#1  0x00000000015d76c0 in fold_using_range::range_of_cond_expr (
    this=0x7fffffff9dff, r=..., s=0x7ffff680e820, src=...)
    at /space/rguenther/src/gcc-clean/gcc/gimple-range-fold.cc:1513
1513      gcc_checking_assert (range_compatible_p (TREE_TYPE (op1), TREE_TYPE
(op2)));

confirmed.

(gdb) p debug_tree (op1)
 <ssa_name 0x7ffff6605840
    type <integer_type 0x7ffff681d690 unsigned int sizes-gimplified public
unsigned SI
        size <integer_cst 0x7ffff681f210 constant 32>
        unit-size <integer_cst 0x7ffff681f228 constant 4>
        align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff681d690 precision:32 min <integer_cst 0x7ffff681f240 0> max <integer_cst
0x7ffff681f1f8 4294967295>
        pointer_to_this <pointer_type 0x7ffff682d738>>
    visited var <var_decl 0x7ffff69ff130 i>
    def_stmt i_18 = PHI <i_15(8), 0(15)>

(gdb) p debug_tree (op2)
 <ssa_name 0x7ffff69d1948
    type <bitint_type 0x7ffff69c9498 public unsigned SI
        size <integer_cst 0x7ffff681f210 constant 32>
        unit-size <integer_cst 0x7ffff681f228 constant 4>
        align:32 warn_if_not_align:0 symtab:0 alias-set 1 canonical-type
0x7ffff69c9498 precision:17 min <integer_cst 0x7ffff69dc618 0> max <integer_cst
0x7ffff69dc558 131071>
        pointer_to_this <pointer_type 0x7ffff69c9540>>
    visited
    def_stmt g1.0_1 = g1;


patt_11 = patt_38 ? i_18 : g1.0_1;


this inconsistency is introduced by vectorizer patterns.  Built by

0x0000000003af9768 in vect_recog_bool_pattern (vinfo=0x57fdf50, 
    stmt_vinfo=0x57ff680, type_out=0x7fffffffc5d8)
    at /space/rguenther/src/gcc-clean/gcc/tree-vect-patterns.cc:6209
6209            = gimple_build_assign (lhs, COND_EXPR, lhs_var,

and taken from

patt_11 = _16 ? i_18 : g1.0_1;

built by

0x0000000003ae8582 in vect_recog_cond_expr_convert_pattern (vinfo=0x57fdf50, 
    stmt_vinfo=0x57feb20, type_out=0x7fffffffc698)
    at /space/rguenther/src/gcc-clean/gcc/tree-vect-patterns.cc:1185
1185      cond_stmt = gimple_build_assign (temp, build3 (COND_EXPR, type,
match[3],

from

_7 = _16 ? _4 : _5;

which was OK.  gimple_cond_expr_convert_p has a match that ends up with
two operands not of the same precision:

/* Floatint point/integer comparison and integer->integer
   or floating point -> float point conversion.  */
(match (cond_expr_convert_p @0 @2 @3 @6)
 (cond (simple_comparison@6 @0 @1) (convert@4 @2) (convert@5 @3))
  (if ((INTEGRAL_TYPE_P (type)
       || (!flag_trapping_math && SCALAR_FLOAT_TYPE_P (type)))
       && ((INTEGRAL_TYPE_P (TREE_TYPE (@2))
            && INTEGRAL_TYPE_P (TREE_TYPE (@3)))
           || (SCALAR_FLOAT_TYPE_P (TREE_TYPE (@2))
               && types_match (TREE_TYPE (@2), TREE_TYPE (@3))))
       && !operand_equal_p (TYPE_SIZE (type), TYPE_SIZE (TREE_TYPE (@0)))
       && operand_equal_p (TYPE_SIZE (TREE_TYPE (@0)),
                           TYPE_SIZE (TREE_TYPE (@2)))
       && operand_equal_p (TYPE_SIZE (TREE_TYPE (@0)),
                           TYPE_SIZE (TREE_TYPE (@3)))
       /* For vect_recog_cond_expr_convert_pattern, @2 and @3 can differ in
          signess when convert is truncation, but not ok for extension since
          it's sign_extend vs zero_extend.  */
       && (known_gt (tree_to_poly_uint64 (TYPE_SIZE (TREE_TYPE (@0))),
                     tree_to_poly_uint64 (TYPE_SIZE (type)))
           || (TYPE_UNSIGNED (TREE_TYPE (@2))
               == TYPE_UNSIGNED (TREE_TYPE (@3))))
       && single_use (@4)
       && single_use (@5))))

r16-605-ge3385fed3fc61a elided a (also insufficient)

-       && (TYPE_PRECISION (TREE_TYPE (@0)) > TYPE_PRECISION (type)

check.

Reply via email to