aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2005-10-26 05:20:19 +0000
committerPaul Thomas <pault@gcc.gnu.org>2005-10-26 05:20:19 +0000
commit976e21f67321ad483895471c5f285a1880a47b4a (patch)
treecb4b3fbc58344b406d2294ab4e6cbe21fb873c8f /gcc/fortran/resolve.c
parent02f8406bd02ea1016df74868d5576138fe760d7d (diff)
downloadgcc-976e21f67321ad483895471c5f285a1880a47b4a.zip
gcc-976e21f67321ad483895471c5f285a1880a47b4a.tar.gz
gcc-976e21f67321ad483895471c5f285a1880a47b4a.tar.bz2
re PR fortran/24158 (ICE in f951 with nested, recursive derived types)
2005-10-26 Paul Thomas <pault@gcc.gnu.org> PR fortran/24158 * decl.c (gfc_match_data_decl): Correct broken bit of code that prevents undefined derived types from being used as components of another derived type. * resolve.c (resolve_symbol): Add backstop error when derived type variables arrive here with a type that has no components. 2005-10-26 Paul Thomas <pault@gcc.gnu.org> PR fortran/24158 gfortran.dg/derived_recursion.f90: New test. gfortran.dg/implicit_actual.f90: New test. From-SVN: r105913
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 6c03126..03206bb 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -4339,6 +4339,24 @@ resolve_symbol (gfc_symbol * sym)
}
}
+ /* If a derived type symbol has reached this point, without its
+ type being declared, we have an error. Notice that most
+ conditions that produce undefined derived types have already
+ been dealt with. However, the likes of:
+ implicit type(t) (t) ..... call foo (t) will get us here if
+ the type is not declared in the scope of the implicit
+ statement. Change the type to BT_UNKNOWN, both because it is so
+ and to prevent an ICE. */
+ if (sym->ts.type == BT_DERIVED
+ && sym->ts.derived->components == NULL)
+ {
+ gfc_error ("The derived type '%s' at %L is of type '%s', "
+ "which has not been defined.", sym->name,
+ &sym->declared_at, sym->ts.derived->name);
+ sym->ts.type = BT_UNKNOWN;
+ return;
+ }
+
/* Ensure that derived type components of a public derived type
are not of a private type. */
if (sym->attr.flavor == FL_DERIVED