Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / gfortran.dg / char_result_8.f90
blobb1dda89a600f082da23fc37b9a184e690121f121
1 ! Related to PR 15326. Compare functions that return string pointers with
2 ! functions that return strings.
3 ! { dg-do run }
4 program main
5 implicit none
7 character (len = 100), target :: string
9 call test (f1 (), 30)
10 call test (f2 (50), 50)
11 call test (f3 (), 30)
12 call test (f4 (70), 70)
14 call indirect (100)
15 contains
16 function f1
17 character (len = 30) :: f1
18 f1 = ''
19 end function f1
21 function f2 (i)
22 integer :: i
23 character (len = i) :: f2
24 f2 = ''
25 end function f2
27 function f3
28 character (len = 30), pointer :: f3
29 f3 => string
30 end function f3
32 function f4 (i)
33 integer :: i
34 character (len = i), pointer :: f4
35 f4 => string
36 end function f4
38 subroutine indirect (i)
39 integer :: i
40 call test (f1 (), 30)
41 call test (f2 (i), i)
42 call test (f3 (), 30)
43 call test (f4 (i), i)
44 end subroutine indirect
46 subroutine test (string, length)
47 character (len = *) :: string
48 integer, intent (in) :: length
49 if (len (string) .ne. length) call abort
50 end subroutine test
51 end program main