2014-07-12 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / save_1.f90
blobb0035f14a7d4f5ebc50e18421cf509b0158254e3
1 ! { dg-do run }
2 ! { dg-options "-O2 -fno-automatic" }
3 subroutine foo (b)
4 logical b
5 integer i, j
6 character*24 s
7 save i
8 if (b) then
9 i = 26
10 j = 131
11 s = 'This is a test string'
12 else
13 if (i .ne. 26 .or. j .ne. 131) call abort
14 if (s .ne. 'This is a test string') call abort
15 end if
16 end subroutine foo
17 subroutine bar (s)
18 character*42 s
19 if (s .ne. '0123456789012345678901234567890123456') call abort
20 call foo (.false.)
21 end subroutine bar
22 subroutine baz
23 character*42 s
24 ! Just clobber stack a little bit.
25 s = '0123456789012345678901234567890123456'
26 call bar (s)
27 end subroutine baz
28 call foo (.true.)
29 call baz
30 call foo (.false.)
31 end