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

            Bug ID: 90948
           Summary: Polymorphic intrinsic assignment...
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jplatas at ull dot edu.es
  Target Milestone: ---

Hi
I'm having problem with polymorphic intrinsic assignment. 
This version fails the compilation in gfortran.

The message is:
F:\GIT_ILL>gfortran -c example2.f90
example2.f90:38:9:

          local%atom(i)=list%atom(i)
         1
Error: Nonallocatable variable must not be polymorphic in intrinsic assignment
at (1) - check that there is a matching specific subroutine for '=' operator


Under my opinion it would be ok.
Javier


Program Check
   implicit none

   !> Type definitions
   Type :: Atm_Type
   End Type Atm_Type

   Type, extends (Atm_type) :: Atm_Std_Type
   End Type Atm_Std_Type

   Type, extends (Atm_std_type) :: Atm_Ref_Type
   End Type Atm_Ref_Type

   Type :: AtList_Type
      integer                                    :: Natoms
      class(Atm_Type), dimension(:), allocatable :: Atom
   end Type AtList_Type

   !> Variables 
   type(AtList_Type) :: list

   call sub(list)

 Contains

   Subroutine Sub(List)
      !---- Argument ----!
      type (AtList_Type), intent(in out) :: List

      !---- Local Variables ----!
      integer            :: i
      type (AtList_Type) :: local

      if (List%natoms <= 0 ) return
      allocate(local%atom(List%natoms))

      do i=1, List%natoms
         local%atom(i)=list%atom(i)
      end do   

   End Subroutine Sub

End Program Check

Reply via email to