[Bug fortran/90948] New: Polymorphic intrinsic assignment...

2019-06-20 Thread jplatas at ull dot edu.es
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

[Bug fortran/91015] New: Which is correct working on polymorphic assignment...

2019-06-27 Thread jplatas at ull dot edu.es
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91015

Bug ID: 91015
   Summary: Which is correct working on polymorphic 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: ---

Created attachment 46526
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46526&action=edit
Example

A comparative between gfortran 8.1 and Intel fortran compiler in assignments
polymorphic variables.

Looking the subroutine Swap_Elements_List, there a zone that works using intel
fortran compiler and not for gfortran.
...
List%reflections(i)=List%reflections(j)
...

And there is a second zone for gfortran (using associate construction) where it
works for Gfortran and not for intel.
associate (t1 => List%reflections(i), t2 => List%reflections(j), tt=> tmp)
tt=t1
t1=t2
t2=tt
end associate

Which version is correct following the standard fortran 2008 rules?