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

--- Comment #6 from janus at gcc dot gnu.org ---
Here is a further reduced test case, based on Dominique's variant in comment
#2, which (I think) runs into the same runtime-segfault when calling
stuff_1d_finaliser ...



module stuff_mod

  implicit none

  type :: stuff_type
    integer :: junk
  contains
    final :: stuff_1d_finaliser
  end type

contains

  subroutine stuff_1d_finaliser( this )
    type(stuff_type), intent(inout) :: this(:)
    integer :: i
    write( 6, '("Finalising stuff_type array")', advance='no' )
    do i = lbound( this, 1 ), ubound( this, 1 )
      write(6, '(" ", I0)', advance='no' ) this(i)%junk
    end do
    write( 6, '()' )
  end subroutine

end module stuff_mod


program test

  use stuff_mod

  implicit none

  integer, parameter :: n = 2

  type test_type
    type(stuff_type) :: things(n)
  end type

  call sub()

contains

  subroutine sub()
    type(test_type) :: tt
    integer :: i
    write( 6, '("Initialising")' )
    do i = 1, n
      tt%things(i) = stuff_type( i )
    end do
    write( 6, '("Done")' )
  end subroutine

end

Reply via email to