aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/interface.c
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2019-01-29 22:40:26 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2019-01-29 22:40:26 +0000
commit5af5f1de35772754e844c391ab5bfa90ad231077 (patch)
tree8225cc326bf0ad06d96ec04962463e1b0ca5af95 /gcc/fortran/interface.c
parentb33d65e3023d5366404e99e4a06e6452d1204b83 (diff)
downloadgcc-5af5f1de35772754e844c391ab5bfa90ad231077.zip
gcc-5af5f1de35772754e844c391ab5bfa90ad231077.tar.gz
gcc-5af5f1de35772754e844c391ab5bfa90ad231077.tar.bz2
re PR fortran/57048 (Handling of C_PTR and C_FUNPTR leads to reject valid)
2019-01-29 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/57048 * interface.c (gfc_compare_types): If a derived type and an integer both have a derived type, and they are identical, this is a C binding type and compares equal. 2019-01-29 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/57048 * gfortran.dg/c_funptr_1.f90: New file. * gfortran.dg/c_funptr_1_mod.f90: New file. From-SVN: r268372
Diffstat (limited to 'gcc/fortran/interface.c')
-rw-r--r--gcc/fortran/interface.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 99011e7..a07e658d 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -692,6 +692,16 @@ gfc_compare_types (gfc_typespec *ts1, gfc_typespec *ts2)
if (ts1->type == BT_VOID || ts2->type == BT_VOID)
return true;
+ /* Special case for our C interop types. FIXME: There should be a
+ 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)
+ return true;
+
/* The _data component is not always present, therefore check for its
presence before assuming, that its derived->attr is available.
When the _data component is not present, then nevertheless the