diff options
author | pault <pault@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-09-05 04:26:10 +0000 |
---|---|---|
committer | pault <pault@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-09-05 04:26:10 +0000 |
commit | a9c394015cef46a9dcc55d5b7745911720f527f7 (patch) | |
tree | 34273f5fee1aa7762e65f398f90e61ede32f6ffc /gcc/fortran/resolve.c | |
parent | b8651da50c282d2b339d92998b94c0536db4bac5 (diff) | |
download | ppe42-gcc-a9c394015cef46a9dcc55d5b7745911720f527f7.tar.gz ppe42-gcc-a9c394015cef46a9dcc55d5b7745911720f527f7.zip |
2006-09-05 Paul Thomas <pault@gcc.gnu.org>
PR fortran/28908
REGRESSION FIX
* gfortran.h : Restore the gfc_dt_list structure and reference
to it in gfc_namespace.
* resolve.c (resolve_fl_derived): Restore the building of the
list of derived types for the current namespace. Modify the
restored code so that a check is made to see if the symbol is
already in the list.
(resolve_fntype): Make sure that the specification block
version of the derived type is used for a module function that
returns that type.
* symbol.c (gfc_free_dt_list): Restore.
(gfc_free_namespace): Restore call to previous.
* trans-types.c (copy_dt_decls_ifequal): Restore.
(gfc_get_derived_type): Restore all the paraphenalia for
association of derived types, including calls to previous.
Modify the restored code such that all derived types are built
if their symbols are found in the parent namespace; not just
non-module types. Add backend_decls to like derived types in
sibling namespaces, as well as that of the derived type.
2006-09-05 Paul Thomas <pault@gcc.gnu.org>
PR fortran/28908
* gfortran.dg/used_types_7.f90: New test.
* gfortran.dg/used_types_8.f90: New test.
* gfortran.dg/used_types_9.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116690 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r-- | gcc/fortran/resolve.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index f1606b19622..b62a0411e9d 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -5368,6 +5368,7 @@ static try resolve_fl_derived (gfc_symbol *sym) { gfc_component *c; + gfc_dt_list * dt_list; int i; for (c = sym->components; c != NULL; c = c->next) @@ -5430,6 +5431,19 @@ resolve_fl_derived (gfc_symbol *sym) } } + /* Add derived type to the derived type list. */ + for (dt_list = sym->ns->derived_types; dt_list; dt_list = dt_list->next) + if (sym == dt_list->derived) + break; + + if (dt_list == NULL) + { + dt_list = gfc_get_dt_list (); + dt_list->next = sym->ns->derived_types; + dt_list->derived = sym; + sym->ns->derived_types = dt_list; + } + return SUCCESS; } @@ -6528,6 +6542,21 @@ resolve_fntype (gfc_namespace * ns) sym->name, &sym->declared_at, sym->ts.derived->name); } + /* Make sure that the type of a module derived type function is in the + module namespace, by copying it from the namespace's derived type + list, if necessary. */ + if (sym->ts.type == BT_DERIVED + && sym->ns->proc_name->attr.flavor == FL_MODULE + && sym->ts.derived->ns + && sym->ns != sym->ts.derived->ns) + { + gfc_dt_list *dt = sym->ns->derived_types; + + for (; dt; dt = dt->next) + if (gfc_compare_derived_types (sym->ts.derived, dt->derived)) + sym->ts.derived = dt->derived; + } + if (ns->entries) for (el = ns->entries->next; el; el = el->next) { @@ -6666,7 +6695,6 @@ resolve_types (gfc_namespace * ns) warn_unused_fortran_label (ns->st_labels); gfc_resolve_uops (ns->uop_root); - } |