PR ipa/83051
[official-gcc.git] / gcc / testsuite / gfortran.dg / dup_save_1.f90
blob7f22b62d16749b8c6331f268ad6ba3e25f3820ab
1 ! { dg-do run }
2 program save_1
3 implicit none
4 integer i
5 integer foo1, foo2, foo3, foo4
6 do i=1,10
7 if (foo1().ne.i) then
8 call abort
9 end if
10 if (foo2().ne.i) then
11 call abort
12 end if
13 if (foo3().ne.i) then
14 call abort
15 end if
16 if (foo4().ne.i) then
17 call abort
18 end if
19 end do
20 end program save_1
22 integer function foo1 ()
23 integer j
24 save
25 save ! { dg-warning "Blanket SAVE" }
26 data j /0/
27 j = j + 1
28 foo1 = j
29 end function foo1
31 integer function foo2 ()
32 integer j
33 save j
34 save j ! { dg-warning "Duplicate SAVE" }
35 data j /0/
36 j = j + 1
37 foo2 = j
38 end function foo2
40 integer function foo3 ()
41 integer j ! { dg-warning "Duplicate SAVE" }
42 save
43 save j ! { dg-warning "SAVE statement" }
44 data j /0/
45 j = j + 1
46 foo3 = j
47 end function foo3
49 integer function foo4 ()
50 integer j ! { dg-warning "Duplicate SAVE" }
51 save j
52 save
53 data j /0/
54 j = j + 1
55 foo4 = j
56 end function foo4