This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [ping] Fix PR debug/66728
- From: Mike Stump <mikestump at comcast dot net>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: Richard Sandiford <richard dot sandiford at arm dot com>, Bernd Schmidt <bschmidt at redhat dot com>, Ulrich Weigand <uweigand at de dot ibm dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 4 Nov 2015 03:57:45 -0800
- Subject: Re: [ping] Fix PR debug/66728
- Authentication-results: sourceware.org; auth=none
- References: <20151028115839 dot 1E7C85C3D at oc7340732750 dot ibm dot com> <87ziz3ta4t dot fsf at e105548-lin dot cambridge dot arm dot com> <5630D8AE dot 1090608 at redhat dot com> <87h9l4v2pi dot fsf at e105548-lin dot cambridge dot arm dot com> <87611kuzz4 dot fsf at e105548-lin dot cambridge dot arm dot com> <D9850ADD-F2B9-4B3E-8DD9-DF8FEB2E9C36 at comcast dot net> <871tc8unnx dot fsf at e105548-lin dot cambridge dot arm dot com> <A6732F72-4484-45B8-8232-7B5BF8DE4949 at comcast dot net> <87wptztqpx dot fsf at e105548-lin dot cambridge dot arm dot com> <29C8CB44-A0EC-4A9A-A4D3-3ABB6D66DA5B at comcast dot net> <CAFiYyc18ZRYXJRPYpU0W2vCf8NZQcd8MngHgUb9ggu8HxZ1NKg at mail dot gmail dot com>
On Nov 4, 2015, at 1:43 AM, Richard Biener <richard.guenther@gmail.com> wrote:
> I think you should limit the effect of this patch to the dwarf2out use
> as the above doesn't make sense to me.
Since dwarf is so special, and since other clients already do something sort of like this anyway, it isn’t unreasonable to make the client be responsible for picking a sensible mode, and asserting if they fail to. This also transfers the cost of the special case code out to the one client that needs it, and avoids that cost for all the other clients.
The new patch is below for your consideration.
Ok?
> Ideally we'd have an assert that you don't create a rtx_mode_t with
> VOIDmode or BLKmode.
Added.
> Handling the CONST_WIDE_INT in dwarf2out.c the same as we did before
> (with CONST_DOUBLE)
> looks sensible as far of fixing a regression (I assume the diff to the
> dwarf results in essentially the
> same DWARF as what was present before wide-int).
Yes, the dwarf is the same.
Index: dwarf2out.c
===================================================================
--- dwarf2out.c (revision 229720)
+++ dwarf2out.c (working copy)
@@ -15593,8 +15593,15 @@
return true;
case CONST_WIDE_INT:
- add_AT_wide (die, DW_AT_const_value,
- std::make_pair (rtl, GET_MODE (rtl)));
+ {
+ machine_mode mode = GET_MODE (rtl);
+ if (mode == VOIDmode)
+ mode = mode_for_size (CONST_WIDE_INT_NUNITS (rtl)
+ * HOST_BITS_PER_WIDE_INT,
+ MODE_INT, 0);
+ add_AT_wide (die, DW_AT_const_value,
+ std::make_pair (rtl, mode));
+ }
return true;
case CONST_DOUBLE:
Index: rtl.h
===================================================================
--- rtl.h (revision 229720)
+++ rtl.h (working copy)
@@ -2086,6 +2086,7 @@
inline unsigned int
wi::int_traits <rtx_mode_t>::get_precision (const rtx_mode_t &x)
{
+ gcc_assert (x.second != BLKmode && x.second != VOIDmode);
return GET_MODE_PRECISION (x.second);
}