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

--- Comment #3 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #2)
> If the declared type has components, gfc_class_data_get builds a COMPONENT_REF
> to the first user component and the copyback assignment overwrites that user
> component with the descriptor data pointer instead of updating the
> coarray's data pointer (wrong-code or a GIMPLE type verification ICE).

The variant doing the above looks like this:

program prog
  implicit none
  type :: t0
    integer :: c0
  end type
  class(t0), allocatable :: x[:]
  allocate(x[*])
  x%c0 = 17
  call s1(x)
  if (x%c0 /= 9) then
    print *, x%c0
    error stop 21
  end if
contains
  subroutine s1(a)
    class(t0), allocatable :: a(..)
    select rank (a)
    rank (0)
      a%c0 = 9
    rank default
      error stop 1
    end select
  end subroutine
end program


It is invalid for the same reasons as the first variant.

Reply via email to