[Bug fortran/85131] New: ICE in gfc_conv_descriptor_data_get

juergen.reuter at desy dot de gcc-bugzilla@gcc.gnu.org
Fri Mar 30 17:35:00 GMT 2018


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

            Bug ID: 85131
           Summary: ICE in gfc_conv_descriptor_data_get
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: juergen.reuter at desy dot de
  Target Milestone: ---

The following code fails with gfortran 4.8.4, 5.4 and 8.0.1, so probably has
never worked correctly in gfortran. It works on ifort v17 and v18:
gfortran  -c quantum_numbers.f90
quantum_numbers.f90:35:0:

        if (present (col))  call qns%qn(i)%set (col=col(i))

internal compiler error: in gfc_conv_descriptor_data_get, at
fortran/trans-array.c:145
with 
gfortran --version
GNU Fortran (GCC) 8.0.1 20180303 (experimental)
I am using svn revision 258198, but the problem is present also in gfortran
4.8.4 and 5.4. I haven't checked 6.4 or 7.3 yet. 
Here is the source code, also attached:
module m
  implicit none
  private

  type :: t1
  end type t1

  type :: t2
     private
     class(t1), allocatable :: c
   contains
     procedure :: set => t2_set
  end type t2

  type :: t3
     private
     integer :: length = 0
     type(t2), dimension(:), allocatable :: qn
   contains
     procedure :: set => t3_set
  end type t3

contains

  impure elemental subroutine t2_set (qn, col)
    class(t2), intent(inout) :: qn
    class(t1), intent(in), optional :: col
  end subroutine t2_set

  subroutine t3_set (qns, col)
    class(t3), intent(inout) :: qns
    class(t1), dimension(:), intent(in), optional :: col
    integer :: i
    do i = 1, qns%length
       if (present (col))  call qns%qn(i)%set (col=col(i))
    end do
  end subroutine t3_set

end module m


More information about the Gcc-bugs mailing list