1! { dg-do compile }
2!
3! PR fortran/51966
4!
5! Contributed by Peter Wind
6!
7
8  type :: Deriv
9    character(len=10) :: name
10  end type
11  character(len=8), dimension(2), parameter :: &
12       DEF_ECOSYSTEMS = (/ "Gridxxxx", "StringYY" /)
13
14  type(Deriv), save :: DepEcoSystem = Deriv(DEF_ECOSYSTEMS(1))
15
16  if (DepEcoSystem%name /= "Gridxxxx" &
17      .or. DepEcoSystem%name(9:9) /= ' ' &
18      .or. DepEcoSystem%name(10:10) /= ' ') STOP 1
19  DepEcoSystem%name = 'ABCDEFGHIJ'
20  call Init_EcoSystems()
21  if (DepEcoSystem%name /= "StringYY" &
22      .or. DepEcoSystem%name(9:9) /= ' ' &
23      .or. DepEcoSystem%name(10:10) /= ' ') STOP 2
24
25contains
26  subroutine Init_EcoSystems()
27    integer :: i =2
28    DepEcoSystem = Deriv(DEF_ECOSYSTEMS(i))
29  end subroutine Init_EcoSystems
30end
31