aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/interface.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2013-07-30 09:20:43 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2013-07-30 09:20:43 +0200
commit60de1c7df5486e81b52c9db5003abba08af7b3f9 (patch)
tree420ee33b8dd91814a2068c907feb2674cb4e5e5a /gcc/fortran/interface.c
parentb882aaa84d700fc91c00ad314e876ce40aab370b (diff)
downloadgcc-60de1c7df5486e81b52c9db5003abba08af7b3f9.zip
gcc-60de1c7df5486e81b52c9db5003abba08af7b3f9.tar.gz
gcc-60de1c7df5486e81b52c9db5003abba08af7b3f9.tar.bz2
re PR fortran/57530 ([OOP] Wrongly rejects type_pointer => class_target (which have identical declared type))
2013-07-30 Tobias Burnus <burnus@net-b.de> PR fortran/57530 * symbol.c (gfc_type_compatible): A type is type compatible with a class if both have the same declared type. * interface.c (compare_type): Reject CLASS/TYPE even if they are type compatible. From-SVN: r201329
Diffstat (limited to 'gcc/fortran/interface.c')
-rw-r--r--gcc/fortran/interface.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 339dd24..9055cf5 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -514,6 +514,12 @@ compare_type (gfc_symbol *s1, gfc_symbol *s2)
if (s2->attr.ext_attr & (1 << EXT_ATTR_NO_ARG_CHECK))
return 1;
+ /* TYPE and CLASS of the same declared type are type compatible,
+ but have different characteristics. */
+ if ((s1->ts.type == BT_CLASS && s2->ts.type == BT_DERIVED)
+ || (s1->ts.type == BT_DERIVED && s2->ts.type == BT_CLASS))
+ return 0;
+
return gfc_compare_types (&s1->ts, &s2->ts) || s2->ts.type == BT_ASSUMED;
}