libgfortran/ChangeLog:
[official-gcc.git] / gcc / testsuite / gfortran.dg / init_flag_7.f90
blob78829811d95249be63ce774070c152595436d718
1 ! { dg-do run }
2 ! { dg-options "-finit-integer=101" }
4 program init_flag_7
5 call save_test1 (.true.)
6 call save_test1 (.false.)
7 call save_test2 (.true.)
8 call save_test2 (.false.)
9 end program init_flag_7
11 ! Test some initializations for both implicitly and
12 ! explicitly declared local variables.
13 subroutine save_test1 (first)
14 logical first
15 integer :: i1 = -100
16 integer i2
17 integer i3
18 save i2
19 if (first) then
20 if (i1 .ne. -100) call abort
21 if (i2 .ne. 101) call abort
22 if (i3 .ne. 101) call abort
23 else
24 if (i1 .ne. 1001) call abort
25 if (i2 .ne. 1002) call abort
26 if (i3 .ne. 101) call abort
27 end if
28 i1 = 1001
29 i2 = 1002
30 i3 = 1003
31 end subroutine save_test1
33 subroutine save_test2 (first)
34 logical first
35 integer :: i1 = -100
36 integer i2
37 save
38 if (first) then
39 if (i1 .ne. -100) call abort
40 if (i2 .ne. 101) call abort
41 else
42 if (i1 .ne. 1001) call abort
43 if (i2 .ne. 1002) call abort
44 end if
45 i1 = 1001
46 i2 = 1002
47 end subroutine save_test2