diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2022-12-09 22:13:45 +0100 |
---|---|---|
committer | Harald Anlauf <anlauf@gmx.de> | 2022-12-09 22:19:26 +0100 |
commit | 01254aa2eb766c7584fd047568d7277d4d65d067 (patch) | |
tree | 8726f23de1cf1d42aa0c37e0b78c2dde810c6384 /gcc/fortran | |
parent | b2e1c49b4a4592f9e96ae9ece8af7d0e6527b194 (diff) | |
download | gcc-01254aa2eb766c7584fd047568d7277d4d65d067.zip gcc-01254aa2eb766c7584fd047568d7277d4d65d067.tar.gz gcc-01254aa2eb766c7584fd047568d7277d4d65d067.tar.bz2 |
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.
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/resolve.cc | 3 |
1 files changed, 2 insertions, 1 deletions
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; |