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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-02-02
     Ever confirmed|0                           |1
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #1 from kargl at gcc dot gnu.org ---
Likely, a duplicate of one of the the 20 or 30 bug reports about
parameterized derived types.

Workaround 1.  Make COPY_TYPE a contained procedures to get an 
explicit interface.  Remove the external statement and the
interface block.

program test_derived_types

   implicit none

   integer, parameter :: n = 10
   integer :: i
   type :: tp(nx)
      integer, len :: nx
      real, dimension(nx) :: x
   end type tp
   type(tp(n)) :: a
   type(tp(n)) :: b

   do i = 1, n
      a%x(i) = i
   end do

   call copy_type(n, a, b)

   contains
      subroutine copy_type(n, a, b)
         integer, intent(in) :: n
         type(tp(n)), intent(in)  :: a
         type(tp(n)), intent(out) :: b
         b = a
      end subroutine copy_type
end program test_derived_types

Reply via email to