2 ! { dg-options "-fbackslash" }
4 character(kind
=1,len
=20) :: s1
5 character(kind
=4,len
=20) :: s4
7 call test_adjust1 (" foo bar ", 4_
" foo bar ")
8 s1
= " foo bar " ; s4
= 4_
" foo bar "
9 call test_adjust2 (s1
, s4
)
11 call test_adjust1 (" foo bar \xFF", 4_
" foo bar \xFF")
12 s1
= " foo bar \xFF" ; s4
= 4_
" foo bar \xFF"
13 call test_adjust2 (s1
, s4
)
15 call test_adjust1 ("\0 foo bar \xFF", 4_
"\0 foo bar \xFF")
16 s1
= "\0 foo bar \xFF" ; s4
= 4_
"\0 foo bar \xFF"
17 call test_adjust2 (s1
, s4
)
19 s4
= "\0 foo bar \xFF"
20 if (adjustl (s4
) /= adjustl (4_
"\0 foo bar \xFF ")) STOP 1
21 if (adjustr (s4
) /= adjustr (4_
"\0 foo bar \xFF ")) STOP 2
23 s4
= " \0 foo bar \xFF"
24 if (adjustl (s4
) /= adjustl (4_
" \0 foo bar \xFF ")) STOP 3
25 if (adjustr (s4
) /= adjustr (4_
" \0 foo bar \xFF ")) STOP 4
27 s4
= 4_
" \U12345678\xeD bar \ufd30"
29 adjustl (4_
" \U12345678\xeD bar \ufd30 ")) STOP 5
31 adjustr (4_
" \U12345678\xeD bar \ufd30 ")) STOP 6
35 subroutine test_adjust1 (s1
, s4
)
37 character(kind
=1,len
=*) :: s1
38 character(kind
=4,len
=*) :: s4
40 character(kind
=1,len
=len(s4
)) :: t1
41 character(kind
=4,len
=len(s1
)) :: t4
43 if (len(s1
) /= len(s4
)) STOP 7
44 if (len(t1
) /= len(t4
)) STOP 8
46 if (len_trim(s1
) /= len_trim (s4
)) STOP 9
50 if (t1
/= adjustl (s1
)) STOP 10
51 if (t4
/= adjustl (s4
)) STOP 11
52 if (len_trim (t1
) /= len_trim (t4
)) STOP 12
53 if (len_trim (adjustl (s1
)) /= len_trim (t4
)) STOP 13
54 if (len_trim (adjustl (s4
)) /= len_trim (t1
)) STOP 14
56 if (len_trim (t1
) /= len (trim (t1
))) STOP 15
57 if (len_trim (s1
) /= len (trim (s1
))) STOP 16
58 if (len_trim (t4
) /= len (trim (t4
))) STOP 17
59 if (len_trim (s4
) /= len (trim (s4
))) STOP 18
63 if (t1
/= adjustr (s1
)) STOP 19
64 if (t4
/= adjustr (s4
)) STOP 20
65 if (len_trim (t1
) /= len_trim (t4
)) STOP 21
66 if (len_trim (adjustr (s1
)) /= len_trim (t4
)) STOP 22
67 if (len_trim (adjustr (s4
)) /= len_trim (t1
)) STOP 23
68 if (len (t1
) /= len_trim (t1
)) STOP 24
69 if (len (t4
) /= len_trim (t4
)) STOP 25
71 if (len_trim (t1
) /= len (trim (t1
))) STOP 26
72 if (len_trim (s1
) /= len (trim (s1
))) STOP 27
73 if (len_trim (t4
) /= len (trim (t4
))) STOP 28
74 if (len_trim (s4
) /= len (trim (s4
))) STOP 29
76 end subroutine test_adjust1
78 subroutine test_adjust2 (s1
, s4
)
80 character(kind
=1,len
=20) :: s1
81 character(kind
=4,len
=20) :: s4
83 character(kind
=1,len
=len(s4
)) :: t1
84 character(kind
=4,len
=len(s1
)) :: t4
86 if (len(s1
) /= len(s4
)) STOP 30
87 if (len(t1
) /= len(t4
)) STOP 31
89 if (len_trim(s1
) /= len_trim (s4
)) STOP 32
93 if (t1
/= adjustl (s1
)) STOP 33
94 if (t4
/= adjustl (s4
)) STOP 34
95 if (len_trim (t1
) /= len_trim (t4
)) STOP 35
96 if (len_trim (adjustl (s1
)) /= len_trim (t4
)) STOP 36
97 if (len_trim (adjustl (s4
)) /= len_trim (t1
)) STOP 37
99 if (len_trim (t1
) /= len (trim (t1
))) STOP 38
100 if (len_trim (s1
) /= len (trim (s1
))) STOP 39
101 if (len_trim (t4
) /= len (trim (t4
))) STOP 40
102 if (len_trim (s4
) /= len (trim (s4
))) STOP 41
106 if (t1
/= adjustr (s1
)) STOP 42
107 if (t4
/= adjustr (s4
)) STOP 43
108 if (len_trim (t1
) /= len_trim (t4
)) STOP 44
109 if (len_trim (adjustr (s1
)) /= len_trim (t4
)) STOP 45
110 if (len_trim (adjustr (s4
)) /= len_trim (t1
)) STOP 46
111 if (len (t1
) /= len_trim (t1
)) STOP 47
112 if (len (t4
) /= len_trim (t4
)) STOP 48
114 if (len_trim (t1
) /= len (trim (t1
))) STOP 49
115 if (len_trim (s1
) /= len (trim (s1
))) STOP 50
116 if (len_trim (t4
) /= len (trim (t4
))) STOP 51
117 if (len_trim (s4
) /= len (trim (s4
))) STOP 52
119 end subroutine test_adjust2