[ping] Fix PR debug/66728

Richard Sandiford richard.sandiford@arm.com
Wed Nov 4 20:51:00 GMT 2015


Mike Stump <mikestump@comcast.net> writes:
> Index: dwarf2out.c
> ===================================================================
> --- dwarf2out.c	(revision 229720)
> +++ dwarf2out.c	(working copy)
> @@ -15593,8 +15593,13 @@
>        return true;
>  
>      case CONST_WIDE_INT:
> -      add_AT_wide (die, DW_AT_const_value,
> -		   std::make_pair (rtl, GET_MODE (rtl)));
> +      {
> +	wide_int w1 = std::make_pair (rtl, MAX_MODE_INT);
> +	int prec = MIN (wi::min_precision (w1, UNSIGNED),
> +			(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;
>  
>      case CONST_DOUBLE:

Setting the precision based on CONST_WIDE_INT_NUNITS means that
we might end up with two different precisions for two values of
the same variable.  E.g. for a 192-bit type, 1<<64 would be given
a precision of 128 (because it needs two HWIs to store) but 1<<128
would be given a precision of 192 (because it needs three HWIs to store).
We could then abort when comparing them for equality, since equality
needs both integers to have the same precision.  E.g. from same_dw_val_p:

    case dw_val_class_wide_int:
      return *v1->v.val_wide == *v2->v.val_wide;

Thanks,
Richard



More information about the Gcc-patches mailing list