[PATCH, Fortran] Fix ICE due to comparison between UNION components

Fritz Reese fritzoreese@gmail.com
Mon Oct 3 18:59:00 GMT 2016


On Sun, Oct 2, 2016 at 6:27 PM, Fritz Reese <fritzoreese@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  <fritzoreese@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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: union_ice.patch2
Type: application/octet-stream
Size: 2564 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20161003/55596dc4/attachment.obj>


More information about the Fortran mailing list