annotate gcc/testsuite/gfortran.dg/char_eoshift_1.f90 @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ! Test eoshift0 for character arrays.
kono
parents:
diff changeset
2 ! { dg-do run }
kono
parents:
diff changeset
3 program main
kono
parents:
diff changeset
4 implicit none
kono
parents:
diff changeset
5 integer, parameter :: n1 = 6, n2 = 5, n3 = 4, slen = 3
kono
parents:
diff changeset
6 character (len = slen), dimension (n1, n2, n3) :: a
kono
parents:
diff changeset
7 character (len = slen) :: filler
kono
parents:
diff changeset
8 integer (kind = 1) :: shift1 = 4
kono
parents:
diff changeset
9 integer (kind = 2) :: shift2 = 2
kono
parents:
diff changeset
10 integer (kind = 4) :: shift3 = 3
kono
parents:
diff changeset
11 integer (kind = 8) :: shift4 = 1
kono
parents:
diff changeset
12 integer :: i1, i2, i3
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 do i3 = 1, n3
kono
parents:
diff changeset
15 do i2 = 1, n2
kono
parents:
diff changeset
16 do i1 = 1, n1
kono
parents:
diff changeset
17 a (i1, i2, i3) = 'abcdef'(i1:i1) // 'ghijk'(i2:i2) // 'lmno'(i3:i3)
kono
parents:
diff changeset
18 end do
kono
parents:
diff changeset
19 end do
kono
parents:
diff changeset
20 end do
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 call test (eoshift (a, shift1, 'foo', 1), int (shift1), 0, 0, 'foo')
kono
parents:
diff changeset
23 call test (eoshift (a, shift2, 'foo', 2), 0, int (shift2), 0, 'foo')
kono
parents:
diff changeset
24 call test (eoshift (a, shift3, 'foo', 2), 0, int (shift3), 0, 'foo')
kono
parents:
diff changeset
25 call test (eoshift (a, shift4, 'foo', 3), 0, 0, int (shift4), 'foo')
kono
parents:
diff changeset
26
kono
parents:
diff changeset
27 filler = ''
kono
parents:
diff changeset
28 call test (eoshift (a, shift1, dim = 1), int (shift1), 0, 0, filler)
kono
parents:
diff changeset
29 call test (eoshift (a, shift2, dim = 2), 0, int (shift2), 0, filler)
kono
parents:
diff changeset
30 call test (eoshift (a, shift3, dim = 2), 0, int (shift3), 0, filler)
kono
parents:
diff changeset
31 call test (eoshift (a, shift4, dim = 3), 0, 0, int (shift4), filler)
kono
parents:
diff changeset
32 contains
kono
parents:
diff changeset
33 subroutine test (b, d1, d2, d3, filler)
kono
parents:
diff changeset
34 character (len = slen), dimension (n1, n2, n3) :: b
kono
parents:
diff changeset
35 character (len = slen) :: filler
kono
parents:
diff changeset
36 integer :: d1, d2, d3
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 do i3 = 1, n3
kono
parents:
diff changeset
39 do i2 = 1, n2
kono
parents:
diff changeset
40 do i1 = 1, n1
kono
parents:
diff changeset
41 if (i1 + d1 .gt. n1 .or. i2 + d2 .gt. n2 .or. i3 + d3 .gt. n3) then
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
42 if (b (i1, i2, i3) .ne. filler) STOP 1
111
kono
parents:
diff changeset
43 else
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
44 if (b (i1, i2, i3) .ne. a (i1 + d1, i2 + d2, i3 + d3)) STOP 2
111
kono
parents:
diff changeset
45 end if
kono
parents:
diff changeset
46 end do
kono
parents:
diff changeset
47 end do
kono
parents:
diff changeset
48 end do
kono
parents:
diff changeset
49 end subroutine test
kono
parents:
diff changeset
50 end program main