aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/decl.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/decl.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/decl.c')
-rw-r--r--gcc/fortran/decl.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 5d4bd56..8c2895ed 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -2075,17 +2075,21 @@ gfc_match_data_decl (void)
if (current_attr.pointer && gfc_current_state () == COMP_DERIVED)
goto ok;
- if (gfc_find_symbol (current_ts.derived->name,
- current_ts.derived->ns->parent, 1, &sym) == 0)
- goto ok;
+ gfc_find_symbol (current_ts.derived->name,
+ current_ts.derived->ns->parent, 1, &sym);
- /* Hope that an ambiguous symbol is itself masked by a type definition. */
- if (sym != NULL && sym->attr.flavor == FL_DERIVED)
+ /* Any symbol that we find had better be a type definition
+ which has its components defined. */
+ if (sym != NULL && sym->attr.flavor == FL_DERIVED
+ && current_ts.derived->components != NULL)
goto ok;
- gfc_error ("Derived type at %C has not been previously defined");
- m = MATCH_ERROR;
- goto cleanup;
+ /* Now we have an error, which we signal, and then fix up
+ because the knock-on is plain and simple confusing. */
+ gfc_error_now ("Derived type at %C has not been previously defined "
+ "and so cannot appear in a derived type definition.");
+ current_attr.pointer = 1;
+ goto ok;
}
ok: