gcc/fortran/interface.cc | 16 ++++++++++++---- gcc/fortran/misc.cc | 7 ++++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/gcc/fortran/interface.cc b/gcc/fortran/interface.cc index c01df0460d7..8c4571e0aa6 100644 --- a/gcc/fortran/interface.cc +++ b/gcc/fortran/interface.cc @@ -736,10 +736,18 @@ gfc_compare_types (gfc_typespec *ts1, gfc_typespec *ts2) better way of doing this. When ISO C binding is cleared up, this can probably be removed. See PR 57048. */ - if (((ts1->type == BT_INTEGER && ts2->type == BT_DERIVED) - || (ts1->type == BT_DERIVED && ts2->type == BT_INTEGER)) - && ts1->u.derived && ts2->u.derived - && ts1->u.derived == ts2->u.derived) + if ((ts1->type == BT_INTEGER + && ts2->type == BT_DERIVED + && ts1->f90_type == BT_VOID + && ts2->u.derived->from_intmod == INTMOD_ISO_C_BINDING + && ts1->u.derived + && strcmp (ts1->u.derived->name, ts2->u.derived->name) == 0) + || (ts2->type == BT_INTEGER + && ts1->type == BT_DERIVED + && ts2->f90_type == BT_VOID + && ts1->u.derived->from_intmod == INTMOD_ISO_C_BINDING + && ts2->u.derived + && strcmp (ts1->u.derived->name, ts2->u.derived->name) == 0)) return true; /* The _data component is not always present, therefore check for its diff --git a/gcc/fortran/misc.cc b/gcc/fortran/misc.cc index bae6d292dc5..edffba07013 100644 --- a/gcc/fortran/misc.cc +++ b/gcc/fortran/misc.cc @@ -138,7 +138,12 @@ gfc_typename (gfc_typespec *ts, bool for_hash) switch (ts->type) { case BT_INTEGER: - sprintf (buffer, "INTEGER(%d)", ts->kind); + if (ts->f90_type == BT_VOID + && ts->u.derived + && ts->u.derived->from_intmod == INTMOD_ISO_C_BINDING) + sprintf (buffer, "TYPE(%s)", ts->u.derived->name); + else + sprintf (buffer, "INTEGER(%d)", ts->kind); break; case BT_REAL: sprintf (buffer, "REAL(%d)", ts->kind);