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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Caused by the (IMHO incorrect) PR66728 changes.
We have 2 spots that fill in dw_loc_oprnd?.v.val_wide:
          mem_loc_result = new_loc_descr (dwarf_OP (DW_OP_const_type), 0, 0);
          mem_loc_result->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
          mem_loc_result->dw_loc_oprnd1.v.val_die_ref.die = type_die;
          mem_loc_result->dw_loc_oprnd1.v.val_die_ref.external = 0;
          mem_loc_result->dw_loc_oprnd2.val_class
            = dw_val_class_wide_int;
          mem_loc_result->dw_loc_oprnd2.v.val_wide = ggc_alloc<wide_int> ();
          *mem_loc_result->dw_loc_oprnd2.v.val_wide = rtx_mode_t (rtl, mode);
and
          loc_result = new_loc_descr (DW_OP_implicit_value,
                                      GET_MODE_SIZE (int_mode), 0);
          loc_result->dw_loc_oprnd2.val_class = dw_val_class_wide_int;
          loc_result->dw_loc_oprnd2.v.val_wide = ggc_alloc<wide_int> ();
          *loc_result->dw_loc_oprnd2.v.val_wide = rtx_mode_t (rtl, int_mode);
and 3 callers of add_AT_wide:
    case CONST_WIDE_INT:
      {
        wide_int w1 = rtx_mode_t (rtl, MAX_MODE_INT);
        unsigned int prec = MIN (wi::min_precision (w1, UNSIGNED),
                                 (unsigned int)CONST_WIDE_INT_NUNITS (rtl) *
HOST_BITS_PER_WIDE_INT);
        wide_int w = wi::zext (w1, prec);
        add_AT_wide (die, DW_AT_const_value, w);
      }
and
      else if (dwarf_version >= 5
               && TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (value))) == 128)
        /* Otherwise represent the bound as an unsigned value with
           the precision of its type.  The precision and signedness
           of the type will be necessary to re-interpret it
           unambiguously.  */
        add_AT_wide (die, attr, wi::to_wide (value));
and
          else
            /* Enumeration constants may be wider than HOST_WIDE_INT.  Handle
               that here.  TODO: This should be re-worked to use correct
               signed/unsigned double tags for all cases.  */
            add_AT_wide (enum_die, DW_AT_const_value, wi::to_wide (value));

Now, I think the PR66728 changes fixed the first add_AT_wide case (iff GET_MODE
(rtl) is VOIDmode only) but at the same time broke all the other 4 cases, which
really expect that the constants in the debug info will have the expected
length.  Some cases like the DW_OP_implicit_value we're hitting here explicitly
on the producer size, as it fills in the size of the constant.

Reply via email to