Debian Codegraph @

gcc/testsuite/gfortran.fortran-torture/execute/strarray_3.f90

raw
1 program strarray_3
2 character(len=5), dimension(2) :: c
3
4 c(1) = "Hello"
5 c(2) = "World"
6
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
16
17 if ((a(1) .ne. "Hello") .or. (a(2) .ne. "World")) STOP 1
18 end subroutine
19
20 subroutine foo2(a, m)
21 implicit none
22 integer m
23 character(len=5), dimension(m) :: a
24
25 if ((a(1) .ne. "Hello") .or. (a(2) .ne. "World")) STOP 2
26 end subroutine
27
28 subroutine foo3(a, n)
29 implicit none
30 integer n
31 character(len=n), dimension(:) :: a
32
33 if ((a(1) .ne. "Hello") .or. (a(2) .ne. "World")) STOP 3
34 end subroutine
35
36 subroutine foo4(a, n, m)
37 implicit none
38 integer n, m
39 character(len=n), dimension(m) :: a
40
41 if ((a(1) .ne. "Hello") .or. (a(2) .ne. "World")) STOP 4
42 end subroutine
43
44 subroutine foo5(a)
45 implicit none
46 character(len=2), dimension(5) :: a
47
48 if ((a(1) .ne. "Wo") .or. (a(3) .ne. "dH") .or. (a(5) .ne. "lo")) STOP 5
49 end subroutine
50 end program