From 01254aa2eb766c7584fd047568d7277d4d65d067 Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Fri, 9 Dec 2022 22:13:45 +0100 Subject: Fortran: ICE on recursive derived types with allocatable components [PR107872] gcc/fortran/ChangeLog: PR fortran/107872 * resolve.cc (derived_inaccessible): Skip over allocatable components to prevent an infinite loop. gcc/testsuite/ChangeLog: PR fortran/107872 * gfortran.dg/pr107872.f90: New test. --- gcc/fortran/resolve.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/fortran') diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index 75dc4b5..158bf08 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -7536,7 +7536,8 @@ derived_inaccessible (gfc_symbol *sym) for (c = sym->components; c; c = c->next) { /* Prevent an infinite loop through this function. */ - if (c->ts.type == BT_DERIVED && c->attr.pointer + if (c->ts.type == BT_DERIVED + && (c->attr.pointer || c->attr.allocatable) && sym == c->ts.u.derived) continue; -- cgit v1.1