summaryrefslogtreecommitdiff
path: root/gcc/fortran/class.c
diff options
context:
space:
mode:
authorpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>2015-11-08 16:47:58 +0000
committerpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>2015-11-08 16:47:58 +0000
commit2bd8d01a59a47b42ac178f7cff9e0879d04ab39f (patch)
tree7720d688995fe86e6ff242df8dbbe7f19bf73554 /gcc/fortran/class.c
parent9c703506eb3c1623d6e2c20834f8b3982a89314d (diff)
2015-11-08 Paul Thomas <pault@gcc.gnu.org>
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 <pault@gcc.gnu.org> PR fortran/68196 * gfortran.dg/proc_ptr_47.f90: New test. PR fortran/66465 * gfortran.dg/pr66465.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229954 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/class.c')
-rw-r--r--gcc/fortran/class.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index 7a9e2755a0fd..8b49ae95a206 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -843,7 +843,11 @@ has_finalizer_component (gfc_symbol *derived)
&& c->ts.u.derived->f2k_derived->finalizers)
return true;
+ /* Stop infinite recursion through this function by inhibiting
+ calls when the derived type and that of the component are
+ the same. */
if (c->ts.type == BT_DERIVED
+ && !gfc_compare_derived_types (derived, c->ts.u.derived)
&& !c->attr.pointer && !c->attr.allocatable
&& has_finalizer_component (c->ts.u.derived))
return true;