------- Comment #5 from pault at gcc dot gnu dot org  2006-11-14 21:08 -------
The remark in #3 that the bug clears if the order of the procedures is reversed
is a giveaway:

Index: gcc/fortran/trans-types.c
===================================================================
*** gcc/fortran/trans-types.c   (revision 118704)
--- gcc/fortran/trans-types.c   (working copy)
*************** gfc_get_derived_type (gfc_symbol * deriv
*** 1592,1602 ****
  other_equal_dts:
    /* Add this backend_decl to all the other, equal derived types and
       their components in this and sibling namespaces.  */
! 
!   for (dt = derived->ns->derived_types; dt; dt = dt->next)
!     copy_dt_decls_ifequal (derived, dt->derived);
! 
!   for (ns = derived->ns->sibling; ns; ns = ns->sibling)
      for (dt = ns->derived_types; dt; dt = dt->next)
        copy_dt_decls_ifequal (derived, dt->derived);

--- 1592,1599 ----
  other_equal_dts:
    /* Add this backend_decl to all the other, equal derived types and
       their components in this and sibling namespaces.  */
!   ns = derived->ns->parent ? derived->ns->parent->contained : derived->ns;
!   for (; ns; ns = ns->sibling)
      for (dt = ns->derived_types; dt; dt = dt->next)
        copy_dt_decls_ifequal (derived, dt->derived);

clears the problem by associated the derived types correctly.

I had previously convinced myself that this scan across all the contained
procedures was not necessary because it should by symmetric under the
interchange of the namespaces. I need to understand why this is not so before
submitting the patch.

Richard,

Could you explain in babytalk, please, what this does?

      gcc_assert (!AGGREGATE_TYPE_P (TREE_TYPE (lse->expr))
                  || TREE_TYPE (lse->expr) == TREE_TYPE (rse->expr));
      gfc_add_modify_expr (&block, lse->expr,
                           !AGGREGATE_TYPE_P (TREE_TYPE (lse->expr))
                           ? fold_convert (TREE_TYPE (lse->expr), rse->expr)
                           : rse->expr);

Is it simply that the fold_convert is simply not doing anything here? ie. when
lse and rse are not the same stuctures, having the fold_convert simply tosses
the detection of the problem elsewhere?

Paul





-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29820

Reply via email to