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

Fritz Reese fritzoreese@gmail.com
Sun Oct 2 22:27:00 GMT 2016


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.

---
Fritz Reese

2016-10-02  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.

        * gcc/testsuite/gfortran.dg/dec_union_9.f90: New testcase.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: union_ice.patch
Type: text/x-patch
Size: 1573 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20161002/16b11c19/attachment.bin>


More information about the Fortran mailing list