* Martin Sebor:

> On 1/21/21 10:34 AM, Florian Weimer wrote:
>> * Martin Sebor via Gcc-patches:
>> 
>>> This patch depends on the fix for PR 98664 (already approved but
>>> not yet checked in).  I've tested it on x86_64-linux.
>>>
>>> To avoid fallout I tried to keep the changes to a minimum, and
>>> so the design isn't as robust as I'd like it ultimately to be.
>>> I plan to enhance it in stage 1.
>> I've tested this patch on top of 43705f3fa343e08b2fb030460f (so with
>> the
>> PR98664 fix, I think), and the reproducer from PR98512 now ICEs:
>
> Thanks for giving it a try!  I saw a similar ICE during my testing
> -- it's caused by a couple of uninitialized variables.  I fixed
> it in my tree (see below) but the fix didn't make it into the patch.
>
> Please give this a try and let me know if it doesn't help:
>
> index abcd991b829..d82a7eb67e5 100644
> --- a/gcc/diagnostic.c
> +++ b/gcc/diagnostic.c
> @@ -1426,7 +1426,7 @@ diagnostic_impl (rich_location *richloc, const
> diagnostic_metadata *metadata,
>                  int opt, const char *gmsgid,
>                  va_list *ap, diagnostic_t kind)
>  {
> -  diagnostic_info diagnostic;
> +  diagnostic_info diagnostic{ };
>    if (kind == DK_PERMERROR)
>      {
>        diagnostic_set_info (&diagnostic, gmsgid, ap, richloc,
> @@ -1452,7 +1452,7 @@ diagnostic_n_impl (rich_location *richloc, const
> diagnostic_metadata *metadata,
>                    const char *plural_gmsgid,
>                    va_list *ap, diagnostic_t kind)
>  {
> -  diagnostic_info diagnostic;
> +  diagnostic_info diagnostic{ };
>    unsigned long gtn;
>
>    if (sizeof n <= sizeof gtn)

This fixes the crash for me, and the warnings is gone as well.

Thanks,
Florian
-- 
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill

Reply via email to