On Sun, Oct 2, 2016 at 6:27 PM, Fritz Reese <fritzore...@gmail.com> wrote:
> All,
>
> The attached fixes an[other] ICE in the comparison between UNIONs.
> This time the ICE is due to a BT_UNION component comparing itself to a
> BT_DERIVED component, thus considering their FL_STRUCT and FL_UNION
> typenodes to be equal. This is very similar to PR fortran/77782,
> except it is an error in the comparison of _components_ from
> gfc_compare_types, instead of an error comparing the _type symbols_
> from gfc_compare_derived. The patch makes sure that BT_UNION compared
> to anything other than BT_UNION is _not_ equal, while still comparing
> two union components with gfc_compare_union_types.
>
> Will commit soon with no complaints. Maybe this patch will finally get
> type comparison right for unions.
>

Meant to include a null-guard as part of the patch, see below.

----
Fritz Reese

2016-10-03  Fritz Reese  <fritzore...@gmail.com>

   Fix ICE due to comparison between UNION components.

        gcc/fortran/
        * interface.c (gfc_compare_types): Don't compare BT_UNION
        components until we know they're both UNIONs.
        * interface.c (gfc_compare_union_types): Guard against empty
        components.

        gcc/testsuite/gfortran.dg/
        * dec_union_9.f90, dec_union_10.f90: New testcases.

Attachment: union_ice.patch2
Description: Binary data

Reply via email to