https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95694
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rsandifo at gcc dot gnu.org Target Milestone|--- |9.4 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- We're expanding <ssa_name 0x7ffff6bc1e10 type <integer_type 0x7ffff6cf03f0 sizes-gimplified public unsigned TI size <integer_cst 0x7ffff6bb7d20 constant 128> unit-size <integer_cst 0x7ffff6bb7d38 constant 16> align:128 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff6cf03f0 precision:65 min <integer_cst 0x7ffff6d0d018 0> max <integer_cst 0x7ffff6cf6100 0x1ffffffffffffffff>> visited def_stmt _5 = (<unnamed-unsigned:65>) _4; version:5> and #2 0x0000000000d9a5bf in reduce_to_bit_field_precision (exp=0x7ffff6d1d180, target=0x0, type=<integer_type 0x7ffff6cf03f0>) at /space/rguenther/src/gcc/gcc/expr.c:11553 (gdb) p debug_rtx (exp) (const_wide_int 0x1fffffffffffffffe) $1 = void (gdb) p debug_tree (type) <integer_type 0x7ffff6cf03f0 sizes-gimplified public unsigned TI size <integer_cst 0x7ffff6bb7d20 type <integer_type 0x7ffff6bd00a8 bitsizetype> constant 128> unit-size <integer_cst 0x7ffff6bb7d38 type <integer_type 0x7ffff6bd0000 sizetype> constant 16> align:128 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff6cf03f0 precision:65 min <integer_cst 0x7ffff6d0d018 0> max <integer_cst 0x7ffff6cf6100 0x1ffffffffffffffff>> $2 = void here a CONST_WIDE_INT does not have a mode. Note somehow the earlier /* For constant values, reduce using build_int_cst_type. */ poly_int64 const_exp; if (poly_int_rtx_p (exp, &const_exp)) { tree t = build_int_cst_type (type, const_exp); return expand_expr (t, target, VOIDmode, EXPAND_NORMAL); } does not trigger. Ah, poly_int64 ... but diff --git a/gcc/expr.c b/gcc/expr.c index ca6b1c1291e..7367e332a05 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -11541,11 +11541,10 @@ reduce_to_bit_field_precision (rtx exp, rtx target, tree type) HOST_WIDE_INT prec = TYPE_PRECISION (type); if (target && GET_MODE (target) != GET_MODE (exp)) target = 0; - /* For constant values, reduce using build_int_cst_type. */ - poly_int64 const_exp; - if (poly_int_rtx_p (exp, &const_exp)) + /* For constant values, reduce using build_poly_int_cst. */ + if (poly_int_rtx_p (exp)) { - tree t = build_int_cst_type (type, const_exp); + tree t = build_poly_int_cst (type, wi::to_poly_wide (exp)); return expand_expr (t, target, VOIDmode, EXPAND_NORMAL); } else if (TYPE_UNSIGNED (type)) does not compile and insists on a mode - but the implementation for poly_int64 does not need a mode. And we shouldn't need one (and the whole point of this path is we don't have one). Richard? Can you please take this?