This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: ICE
Salvatore,
This problem that you found is very wierd - I have analysed it in some
detail and find that the problem is arising because trans-types.c looks
for equal derived types in the parent of the derived type's own
namespace. If it finds an equal derived type, it uses the tree
declaration in the parent space or builds it, if that has not already
been done. In the case of the derived type, enclosed by the interface
in your example, the derived type's namespace does not have a parent.
Instead, it has to use the parent of the procedure's namespace; why
these are not the same, I do not understand, as yet. Equally, the gfc
of three weeks ago was not equipped to make the necessary association,
as far as I can tell. I think that this regression has creapt in from
anther patch but I could be wrong.
The attached patch accomplishes the assocation, as described, and
regtests on Athlon/FC5.
I will commit it, with a suitable ChangeLog and testcase, as soon as I
am back.
Paul
Index: gcc/fortran/trans-types.c
===================================================================
*** gcc/fortran/trans-types.c (revision 116690)
--- gcc/fortran/trans-types.c (working copy)
*************** gfc_get_derived_type (gfc_symbol * deriv
*** 1483,1489 ****
same TREE_TYPE. If an equal type is found without a backend_decl,
build the parent version and use it in the current namespace. */
! for (ns = derived->ns->parent; ns; ns = ns->parent)
{
for (dt = ns->derived_types; dt; dt = dt->next)
{
--- 1483,1494 ----
same TREE_TYPE. If an equal type is found without a backend_decl,
build the parent version and use it in the current namespace. */
! /* Derived types in an interface body obtain their parent reference
! through the proc_name symbol. */
! ns = derived->ns->parent ? derived->ns->parent
! : derived->ns->proc_name->ns->parent;
!
! for (; ns; ns = ns->parent)
{
for (dt = ns->derived_types; dt; dt = dt->next)
{