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

            Bug ID: 68426
           Summary: Simplification of SPREAD with a derived type element
                    causes ICE
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kargl at gcc dot gnu.org
  Target Milestone: ---

In fixing PR 59910, I mentioned that the patch may not
fix a potential problem with similar code in a PARAMETER.
Dominiq posted


  module m
    implicit none
    type t
      integer :: i
    end type t
    type(t), dimension(2), parameter :: a1  = (/ t(1), t(2) /)
    type(t), dimension(1), parameter :: c = spread ( a1(1), 1, 1 )
  end module m

which indeed leads to an ICE   

f951: internal compiler error: in gfc_conv_array_initializer, at
fortran/trans-array.c:5704

The problem is that gfc_simplify_spread bails out because
soource->expr_type == EXPR_STRUCTURE and SPREAD is not
simplified.  This then generates a function and
gfc_conv_array_initializer gets expr->expt_type==EXPR_FUNCTION
which she can't deal with.

The fix lies in gfc_simplify_spread.

Reply via email to