1! { dg-do run }
2! { dg-options "-fbackslash" }
3
4  implicit none
5  character(kind=1,len=3) :: s1(3)
6  character(kind=4,len=3) :: s4(3)
7
8  s1 = [ "abc", "def", "ghi" ]
9  s4 = s1
10  s4 = [ "abc", "def", "ghi" ]
11
12  if (any (cshift (s1, 0) /= s1)) call abort
13  if (any (cshift (s4, 0) /= s4)) call abort
14  if (any (cshift (s1, 3) /= s1)) call abort
15  if (any (cshift (s4, 3) /= s4)) call abort
16  if (any (cshift (s1, 6) /= s1)) call abort
17  if (any (cshift (s4, 6) /= s4)) call abort
18  if (any (cshift (s1, -3) /= s1)) call abort
19  if (any (cshift (s4, -3) /= s4)) call abort
20  if (any (cshift (s1, -6) /= s1)) call abort
21  if (any (cshift (s4, -6) /= s4)) call abort
22
23  if (any (cshift (s1, 1) /= [ s1(2:3), s1(1) ])) call abort
24  if (any (cshift (s1, -1) /= [ s1(3), s1(1:2) ])) call abort
25  if (any (cshift (s1, 4) /= [ s1(2:3), s1(1) ])) call abort
26  if (any (cshift (s1, -4) /= [ s1(3), s1(1:2) ])) call abort
27
28  if (any (cshift (s4, 1) /= [ s4(2:3), s4(1) ])) call abort
29  if (any (cshift (s4, -1) /= [ s4(3), s4(1:2) ])) call abort
30  if (any (cshift (s4, 4) /= [ s4(2:3), s4(1) ])) call abort
31  if (any (cshift (s4, -4) /= [ s4(3), s4(1:2) ])) call abort
32
33  if (any (cshift (s1, 2) /= [ s1(3), s1(1:2) ])) call abort
34  if (any (cshift (s1, -2) /= [ s1(2:3), s1(1) ])) call abort
35  if (any (cshift (s1, 5) /= [ s1(3), s1(1:2) ])) call abort
36  if (any (cshift (s1, -5) /= [ s1(2:3), s1(1) ])) call abort
37
38  if (any (cshift (s4, 2) /= [ s4(3), s4(1:2) ])) call abort
39  if (any (cshift (s4, -2) /= [ s4(2:3), s4(1) ])) call abort
40  if (any (cshift (s4, 5) /= [ s4(3), s4(1:2) ])) call abort
41  if (any (cshift (s4, -5) /= [ s4(2:3), s4(1) ])) call abort
42
43
44  if (any (eoshift (s1, 0) /= s1)) call abort
45  if (any (eoshift (s4, 0) /= s4)) call abort
46  if (any (eoshift (s1, 3) /= "")) call abort
47  if (any (eoshift (s4, 3) /= 4_"")) call abort
48  if (any (eoshift (s1, 3, "   ") /= "")) call abort
49  if (any (eoshift (s4, 3, 4_"   ") /= 4_"")) call abort
50  if (any (eoshift (s1, 3, " x ") /= " x")) call abort
51  if (any (eoshift (s4, 3, 4_" x ") /= 4_" x")) call abort
52  if (any (eoshift (s1, -3) /= "")) call abort
53  if (any (eoshift (s4, -3) /= 4_"")) call abort
54  if (any (eoshift (s1, -3, "   ") /= "")) call abort
55  if (any (eoshift (s4, -3, 4_"   ") /= 4_"")) call abort
56  if (any (eoshift (s1, -3, " x ") /= " x")) call abort
57  if (any (eoshift (s4, -3, 4_" x ") /= 4_" x")) call abort
58  if (any (eoshift (s1, 4) /= "")) call abort
59  if (any (eoshift (s4, 4) /= 4_"")) call abort
60  if (any (eoshift (s1, 4, "   ") /= "")) call abort
61  if (any (eoshift (s4, 4, 4_"   ") /= 4_"")) call abort
62  if (any (eoshift (s1, 4, " x ") /= " x")) call abort
63  if (any (eoshift (s4, 4, 4_" x ") /= 4_" x")) call abort
64  if (any (eoshift (s1, -4) /= "")) call abort
65  if (any (eoshift (s4, -4) /= 4_"")) call abort
66  if (any (eoshift (s1, -4, "   ") /= "")) call abort
67  if (any (eoshift (s4, -4, 4_"   ") /= 4_"")) call abort
68  if (any (eoshift (s1, -4, " x ") /= " x")) call abort
69  if (any (eoshift (s4, -4, 4_" x ") /= 4_" x")) call abort
70
71  if (any (eoshift (s1, 1) /= [ s1(2:3), "   " ])) call abort
72  if (any (eoshift (s1, -1) /= [ "   ", s1(1:2) ])) call abort
73  if (any (eoshift (s1, 1, " x ") /= [ s1(2:3), " x " ])) call abort
74  if (any (eoshift (s1, -1, " x ") /= [ " x ", s1(1:2) ])) call abort
75  if (any (eoshift (s4, 1) /= [ s4(2:3), 4_"   " ])) call abort
76  if (any (eoshift (s4, -1) /= [ 4_"   ", s4(1:2) ])) call abort
77  if (any (eoshift (s4, 1, 4_" x ") /= [ s4(2:3), 4_" x " ])) call abort
78  if (any (eoshift (s4, -1, 4_" x ") /= [ 4_" x ", s4(1:2) ])) call abort
79
80  if (any (eoshift (s1, 2) /= [ s1(3), "   ", "   " ])) call abort
81  if (any (eoshift (s1, -2) /= [ "   ", "   ", s1(1) ])) call abort
82  if (any (eoshift (s1, 2, " x ") /= [ s1(3), " x ", " x " ])) call abort
83  if (any (eoshift (s1, -2, " x ") /= [ " x ", " x ", s1(1) ])) call abort
84  if (any (eoshift (s4, 2) /= [ s4(3), 4_"   ", 4_"   " ])) call abort
85  if (any (eoshift (s4, -2) /= [ 4_"   ", 4_"   ", s4(1) ])) call abort
86  if (any (eoshift (s4, 2, 4_" x ") /= [ s4(3), 4_" x ", 4_" x " ])) call abort
87  if (any (eoshift (s4, -2, 4_" x ") /= [ 4_" x ", 4_" x ", s4(1) ])) call abort
88
89end
90