summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/init_flag_7.f90
blob: 78829811d95249be63ce774070c152595436d718 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
! { dg-do run }
! { dg-options "-finit-integer=101" }

program init_flag_7
  call save_test1 (.true.)
  call save_test1 (.false.) 
  call save_test2 (.true.)
  call save_test2 (.false.)
end program init_flag_7

! Test some initializations for both implicitly and
! explicitly declared local variables.
subroutine save_test1 (first)
  logical first
  integer :: i1 = -100
  integer i2
  integer i3
  save i2
  if (first) then
     if (i1 .ne. -100) call abort
     if (i2 .ne. 101) call abort
     if (i3 .ne. 101) call abort
  else
     if (i1 .ne. 1001) call abort
     if (i2 .ne. 1002) call abort
     if (i3 .ne. 101) call abort
  end if
  i1 = 1001
  i2 = 1002
  i3 = 1003
end subroutine save_test1
        
subroutine save_test2 (first)
  logical first
  integer :: i1 = -100
  integer i2
  save
  if (first) then
     if (i1 .ne. -100) call abort
     if (i2 .ne. 101) call abort
  else
     if (i1 .ne. 1001) call abort
     if (i2 .ne. 1002) call abort
  end if
  i1 = 1001
  i2 = 1002
end subroutine save_test2