! { dg-do run }
!
! Test the fix for PR84119.
!
! Contributed by Neil Carlson  <neil.n.carlson@gmail.com>
!
  type :: vector(dim,kind)
    integer, len :: dim
    integer, kind :: kind
    real(kind=kind) :: vect(dim)
  end type
  integer :: length
  length = 3
  call foo
  length = 8
  call foo
contains
  subroutine foo
! Make 'a' an automatic variable to stretch gfortran a bit more.
    type(vector(length, 4)) :: a(3:10)
! LEN and KIND references were incorrectly returned as arrays.
    if (size (shape (a%dim)) /= 0) stop 1
    if (size (shape (a%kind)) /= 0) stop 2
! Make sure that the values are correct...
    if (a%dim .ne. length) stop 3
    if (a%kind .ne. 4) stop 4
! ... and that the vector component has the right size.
    if (size(a(3)%vect) .ne. length) stop 5
  end subroutine foo
end
