From 57905c2bb3dc00409591f58a8e335cd16c2940ff Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Sun, 8 Nov 2015 16:47:58 +0000 Subject: re PR fortran/68196 (ICE on function result with procedure pointer component) 2015-11-08 Paul Thomas PR fortran/68196 * class.c (has_finalizer_component): Prevent infinite recursion through this function if the derived type and that of its component are the same. * trans-types.c (gfc_get_derived_type): Do the same for proc pointers by ignoring the explicit interface for the component. PR fortran/66465 * check.c (same_type_check): If either of the expressions is BT_PROCEDURE, use the typespec from the symbol, rather than the expression. 2015-11-08 Paul Thomas PR fortran/68196 * gfortran.dg/proc_ptr_47.f90: New test. PR fortran/66465 * gfortran.dg/pr66465.f90: New test. From-SVN: r229954 --- gcc/fortran/check.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'gcc/fortran/check.c') diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index 86dae5b..038ee21 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -399,7 +399,15 @@ less_than_bitsize2 (const char *arg1, gfc_expr *expr1, const char *arg2, static bool same_type_check (gfc_expr *e, int n, gfc_expr *f, int m) { - if (gfc_compare_types (&e->ts, &f->ts)) + gfc_typespec *ets = &e->ts; + gfc_typespec *fts = &f->ts; + + if (e->ts.type == BT_PROCEDURE && e->symtree->n.sym) + ets = &e->symtree->n.sym->ts; + if (f->ts.type == BT_PROCEDURE && f->symtree->n.sym) + fts = &f->symtree->n.sym->ts; + + if (gfc_compare_types (ets, fts)) return true; gfc_error ("%qs argument of %qs intrinsic at %L must be the same type " -- cgit v1.1