https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114535

--- Comment #4 from Paul Thomas <pault at gcc dot gnu.org> ---
Created attachment 57839
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57839&action=edit
"Fix" for this PR

Even though no entities of type 'vs' are being referenced in subroutine iss,
gfortran currently feels the need to generate a final wrapper for it. The
comment in the patch explains what is happening but not why. I suspect that the
evil is being done somewhere in resolve.cc and will investigate in another
session.

Note the comments in the testcase below:

module d
  implicit none
contains
  function en() result(dd)
    use :: iv
    implicit none
    type(vs) :: dd
    dd%i = 1
  end function en
end module d

! Comment out line 1 and all brands complain that 'vs' is an undefined type
! Comment out line 1 and line 2 allows compilation to proceed (with fix for
gfortran)
module ni
  implicit none
contains
  subroutine iss()
    use :: iv                                        ! line 1
    use :: d
    implicit none
    type(vs) :: ans; ans = en(); print *, ctr, ans%i ! line 2
  end subroutine iss
end module ni

  use ni
  call iss()
  call iss()
!  print *, ctr
end

Reply via email to