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

--- Comment #11 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to vehre from comment #9)
> I am still wondering whether there isn't a counterexample where this is not
> working, i.e., we have lhs-rhs-dependency that is polymorphic. But because
> assignment to (allocatable) polymorphic entities is not allowed, I could not
> come up with one.

Same for me.
The following class variant of the test could fail if/when gfortran supports
assignment to polymorphic entities, I think.
It is currently simply rejected.

  type :: t
    integer :: c
  end type t

  type(t),  dimension(5) :: a, b
  class(t), dimension(:), allocatable :: c

  a = t(1)
  b = t(7)
  allocate(c(5), source=t(13))
  c = plus(c(1), b)
  print *, c
  if (any(c%c /= 20)) call abort

contains

  elemental function plus(lhs, rhs)
    class(t), intent(in) :: lhs, rhs
    type(t)             :: plus
    plus%c = lhs%c + rhs%c
  end function plus

end

Reply via email to