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

            Bug ID: 83725
           Summary: [8 Regression] Another ICE:: in gfc_add_modify_loc, at
                    fortran/trans.c:159
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dominiq at lps dot ens.fr
                CC: jb at gcc dot gnu.org
  Target Milestone: ---

Compiling the following variant of pr65381:

module stringtable_mod

    implicit none
    private
    save

    type, public :: StringList
        character(:), allocatable :: chars
    end type

    type, public :: StringTable
        type(StringList), allocatable :: list(:)
    end type
contains
    pure function fixedStringTable(this) result(fixed)
!        class(StringTable), intent(IN) :: this(:)
        type(StringTable), intent(IN) :: this(:)
        character(LEN_MAX(this)) :: fixed(getTableSize(this))
        integer :: i, j, k
        k = 0
        do i = 1, SIZE(this)
            if (.NOT. ALLOCATED(this(i)%list)) cycle

            do j = 1, SIZE(this(i)%list)
                k = k + 1
                fixed(k) = this(i)%list(j)%chars
            enddo
        enddo
        integer :: ln, sz
        character(:), allocatable :: strings(:)
        ln = LEN_MAX(this)
        sz = getTableSize(this)
        allocate (character(ln) :: strings(sz))
        strings(:) = fixedStringTable(this)
        joined=''
    end function

    pure function LEN_MAX(this) result(stringlen)
        integer :: stringlen
        type(StringTable), intent(IN) :: this(:)
        integer :: i, j
        stringlen = 0
    end function

    pure function getTableSize(this) result(sz)
        integer :: sz
        type(StringTable), intent(IN) :: this(:)
        integer :: i
        sz = 0
    end function

end module stringtable_mod
end

gives the ICE

pr65381_red.f90:15:0:

     pure function fixedStringTable(this) result(fixed)

internal compiler error: in gfc_add_modify_loc, at fortran/trans.c:159

It compiles with gfortran 7.2.0 and trunk before r256284 and it is not fixed by
revision r256310.

Reply via email to