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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code

--- Comment #32 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
The problem is a bit deeper.

First, something I forgot to mention: We now ICE on

  type :: t
    integer :: c
  end type t

  class(t), dimension(:), allocatable :: b,c

  allocate (b(5), source=t(7))
  allocate(c(5), source=t(13))
  c = plus(c(1), b)
  print *, c%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


Going up from the ICE, it can be seen that gfc_trans_assignment_1
gets the arguments

(gdb) call debug(expr1)
MAIN__:c % _data(FULL) (CLASS __class_MAIN___T_1_0a)
(gdb) call debug(expr2)
plus[[((MAIN__:c(1)) (MAIN__:b % _data(FULL)))]] (DERIVED t)

so there is no _data for c(1).  I suspect this is the cause
of the trouble.

In gfc_conv_resolve_dependencies, we then see

(gdb) call debug(dest->info->expr)
MAIN__:c % _data(FULL) (CLASS __class_MAIN___T_1_0a)
(gdb) call debug(rss->info->expr)
MAIN__:c(1) (CLASS __class_MAIN___T_1_0a)

which gets handed further down, leading to the problem.

Reply via email to