1! { dg-do run }
2!
3! PR fortran/30940
4program main
5  implicit none
6  character(len=10) :: digit_string = '123456789', str
7  character :: digit_arr(10)
8  call copy(digit_string, digit_arr)
9  call copy(digit_arr,str)
10  if(str /= '123456789') call abort()
11  digit_string = 'qwertasdf'
12  call copy2(digit_string, digit_arr)
13  call copy2(digit_arr,str)
14  if(str /= 'qwertasdf') call abort()
15  digit_string = '1qayxsw23e'
16  call copy3("1qayxsw23e", digit_arr)
17  call copy3(digit_arr,str)
18  if(str /= '1qayxsw23e') call abort()
19contains
20  subroutine copy(in, out)
21    character, dimension(*)  :: in
22    character, dimension(10) :: out
23    out = in(:10)
24  end subroutine copy
25  subroutine copy2(in, out)
26    character, dimension(2,*)  :: in
27    character, dimension(2,5) :: out
28    out(1:2,1:5) = in(1:2,1:5)
29  end subroutine copy2
30  subroutine copy3(in, out)
31    character(len=2), dimension(5)  :: in
32    character(len=2), dimension(5) :: out
33    out = in
34  end subroutine copy3
35end program main
36