Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gfortran.fortran-torture / execute / strarray_3.f90
blob637c1df94f052758cac2405706488f686a3e0287
1 program strarray_3
2 character(len=5), dimension(2) :: c
4 c(1) = "Hello"
5 c(2) = "World"
7 call foo1(c)
8 call foo2(c, 2)
9 call foo3(c, 5)
10 call foo4(c, 5, 2)
11 call foo5(c(2:1:-1))
12 contains
13 subroutine foo1(a)
14 implicit none
15 character(len=5), dimension(2) :: a
17 if ((a(1) .ne. "Hello") .or. (a(2) .ne. "World")) STOP 1
18 end subroutine
20 subroutine foo2(a, m)
21 implicit none
22 integer m
23 character(len=5), dimension(m) :: a
25 if ((a(1) .ne. "Hello") .or. (a(2) .ne. "World")) STOP 2
26 end subroutine
28 subroutine foo3(a, n)
29 implicit none
30 integer n
31 character(len=n), dimension(:) :: a
33 if ((a(1) .ne. "Hello") .or. (a(2) .ne. "World")) STOP 3
34 end subroutine
36 subroutine foo4(a, n, m)
37 implicit none
38 integer n, m
39 character(len=n), dimension(m) :: a
41 if ((a(1) .ne. "Hello") .or. (a(2) .ne. "World")) STOP 4
42 end subroutine
44 subroutine foo5(a)
45 implicit none
46 character(len=2), dimension(5) :: a
48 if ((a(1) .ne. "Wo") .or. (a(3) .ne. "dH") .or. (a(5) .ne. "lo")) STOP 5
49 end subroutine
50 end program