1! { dg-do compile }
2!
3! PR fortran/30940
4program test
5implicit none
6interface
7  subroutine foo(a)
8     character(len=1),dimension(:) :: a
9  end subroutine foo
10  subroutine bar(a)
11     character(len=1),dimension(:,:) :: a
12  end subroutine bar
13  subroutine foobar(a)
14     character(len=1),dimension(4) :: a
15  end subroutine foobar
16  subroutine arr(a)
17     character(len=1),dimension(1,2,1,2) :: a
18  end subroutine arr
19end interface
20  character(len=2) :: len2
21  character(len=4) :: len4
22  len2 = '12'
23  len4 = '1234'
24
25  call foo(len2) ! { dg-error "Rank mismatch in argument" }
26  call foo("ca") ! { dg-error "Rank mismatch in argument" }
27  call bar("ca") ! { dg-error "Rank mismatch in argument" }
28  call foobar(len2) ! { dg-warning "contains too few elements" }
29  call foobar(len4)
30  call foobar("bar") ! { dg-warning "contains too few elements" }
31  call foobar("bar33")
32  call arr(len2) ! { dg-warning "contains too few elements" }
33  call arr(len4)
34  call arr("bar") ! { dg-warning "contains too few elements" }
35  call arr("bar33")
36end program test
37