arm: Add .type and .size to __gnu_cmse_nonsecure_call [PR115360]
[official-gcc.git] / gcc / testsuite / gfortran.dg / write_recursive.f90
blobbe737baca346a65e5add3f068999e0fbf6a1bcf4
1 ! { dg-do run }
2 ! PR26766 Recursive I/O with internal units
3 ! Test case derived from example in PR
4 ! Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org>
5 program pr26766
6 implicit none
7 character (len=8) :: str, tmp
8 write (str, '(a)') bar (1234)
9 if (str.ne."abcd") STOP 1
10 str = "wxyz"
11 write (str, '(2a4)') foo (1), bar (1)
12 if (str.ne."abcdabcd") STOP 2
14 contains
16 function foo (i) result (s)
17 integer, intent(in) :: i
18 character (len=4) :: s, t
19 if (i < 0) then
20 s = "1234"
21 else
22 ! Internal I/O, allowed recursive in f2003, see section 9.11
23 write (s, '(a)') "abcd"
24 end if
25 end function foo
27 function bar (i) result (s)
28 integer, intent(in) :: i
29 character (len=4) :: s, t
30 if (i < 0) then
31 s = "4567"
32 else
33 write (s, '(a)') foo(i)
34 end if
35 end function bar
37 end program pr26766