1 ! Related to PR 15326. Test calls to string functions whose lengths
2 ! depend on various types of scalar value.
4 pure
function select (selector
, iftrue
, iffalse
)
5 logical, intent (in
) :: selector
6 integer, intent (in
) :: iftrue
, iffalse
20 pure
function select (selector
, iftrue
, iffalse
)
21 logical, intent (in
) :: selector
22 integer, intent (in
) :: iftrue
, iffalse
28 integer :: left
, right
32 integer, pointer :: ip
36 logical, pointer :: lp
38 complex, pointer :: cp
39 character, target
:: ch
40 character, pointer :: chp
41 type (pair
), target
:: p
42 type (pair
), pointer :: pp
44 character (len
= 10) :: dig
63 call test (f1 (i
), 200)
64 call test (f1 (ip
), 200)
65 call test (f1 (-30), 60)
66 call test (f1 (i
/ (-4)), 50)
68 call test (f2 (r
), 100)
69 call test (f2 (rp
), 100)
70 call test (f2 (70.1), 140)
71 call test (f2 (r
/ 4), 24)
72 call test (f2 (real (i
)), 200)
74 call test (f3 (l
), 50)
75 call test (f3 (lp
), 50)
76 call test (f3 (.false
.), 55)
77 call test (f3 (i
< 30), 55)
79 call test (f4 (c
), 10)
80 call test (f4 (cp
), 10)
81 call test (f4 (cmplx (60.0, r
)), 60)
82 call test (f4 (cmplx (r
, 1.0)), 50)
84 call test (f5 (ch
), 11)
85 call test (f5 (chp
), 11)
86 call test (f5 ('23'), 12)
87 call test (f5 (dig (3:)), 13)
88 call test (f5 (dig (10:)), 10)
90 call test (f6 (p
), 145)
91 call test (f6 (pp
), 145)
92 call test (f6 (pair (20, 10)), 85)
93 call test (f6 (pair (i
/ 2, 1)), 106)
97 character (len
= abs (i
) * 2) :: f1
103 character (len
= floor (r
) * 2) :: f2
109 character (len
= select (l
, 50, 55)) :: f3
115 character (len
= int (c
)) :: f4
121 character (len
= scan ('123456789', c
) + 10) :: f5
128 character (len
= sum ((/ p
%left
, p
%right
, (i
, i
= 1, 10) /))) :: f6
132 subroutine test (string
, length
)
133 character (len
= *) :: string
134 integer, intent (in
) :: length
135 if (len (string
) .ne
. length
) call abort