------- Comment #5 from pault at gcc dot gnu dot org  2007-04-13 13:32 -------
Daniel,

This turns out to be a problem of carts and horses.  I very rapidly found that
I could fix this problem and break everything else by reversing the order of
the gfc_derived_types list.  After much head scratching, I found that derived
types were picking up component derived types from contained procedures or,
still worse, interfaces.  The patch below fixes this by copying derived type
declarations in the same namespace first, followed by other namespaces
afterwards.  I am not entirely convinced that this is the whole story.  It
fixes the problem and regtests fine but..... just give me 24 hours to dwell on
it:)

If you are in a position to check that this fixes 31551, I would be grateful
that you try.

Paul

Index: gcc/fortran/trans-types.c
===================================================================
*** gcc/fortran/trans-types.c   (révision 123693)
--- gcc/fortran/trans-types.c   (copie de travail)
*************** gfc_get_derived_type (gfc_symbol * deriv
*** 1563,1569 ****

      /* Add this backend_decl to all the other, equal derived types.  */
      for (dt = gfc_derived_types; dt; dt = dt->next)
!       copy_dt_decls_ifequal (derived, dt->derived);

    return derived->backend_decl;
  }
--- 1563,1574 ----

      /* Add this backend_decl to all the other, equal derived types.  */
      for (dt = gfc_derived_types; dt; dt = dt->next)
!       if (derived->ns == dt->derived->ns)
!       copy_dt_decls_ifequal (derived, dt->derived);
!
!     for (dt = gfc_derived_types; dt; dt = dt->next)
!       if (derived->ns != dt->derived->ns)
!       copy_dt_decls_ifequal (derived, dt->derived);

    return derived->backend_decl;
  }


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-04-12 18:52:04         |2007-04-13 13:32:31
               date|                            |


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

Reply via email to