PR28959 fix causes a regression:

    module A
      type :: T
        integer :: u
      end type T
    end module A

    module B
    contains
      function foo()
        use A
        type(T), pointer :: foo
        nullify (foo)
      end function foo
    end module B

    subroutine bar()
      use B             ! The order here is important
      use A             ! If use A comes before use B, it works
      type(T), pointer :: x
      x => foo()
    end subroutine bar

ICEs because in:
 -      for (ns = derived->ns->parent; ns; ns = ns->parent)
 +      /* 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)

both derived->ns->parent and derived->ns->proc_name are NULL.


-- 
           Summary: [4.1/4.2/4.3 regression] ICE in gfc_get_derived_type
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


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

Reply via email to