2021-03-13 Jakub Jelinek PR debug/99562 PR debug/66728 * dwarf2out.c (get_full_len): Use get_precision rather than min_precision. (add_const_value_attribute): Make sure add_AT_wide argument has precision prec rather than some very wide one. --- gcc/dwarf2out.c.jj 2021-03-11 14:01:43.385194205 +0100 +++ gcc/dwarf2out.c 2021-03-12 17:34:49.365207265 +0100 @@ -385,13 +385,12 @@ dump_struct_debug (tree type, enum debug #endif /* Get the number of HOST_WIDE_INTs needed to represent the precision - of the number. Some constants have a large uniform precision, so - we get the precision needed for the actual value of the number. */ + of the number. */ static unsigned int get_full_len (const wide_int &op) { - int prec = wi::min_precision (op, UNSIGNED); + int prec = wi::get_precision (op); return ((prec + HOST_BITS_PER_WIDE_INT - 1) / HOST_BITS_PER_WIDE_INT); } @@ -19732,8 +19731,9 @@ add_const_value_attribute (dw_die_ref di { 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); + (unsigned int) CONST_WIDE_INT_NUNITS (rtl) + * HOST_BITS_PER_WIDE_INT); + wide_int w = wide_int::from (w1, prec, UNSIGNED); add_AT_wide (die, DW_AT_const_value, w); } return true;