This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/31550] [regression] f951: segfault in fold-const.c:1963



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]