2010-12-20 Tobias Burnus <burnus@net-b.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / dup_save_2.f90
bloba0d340ad6e8f873dbfa6c88783dbd9b17b585f45
1 ! { dg-do compile }
2 ! { dg-options "-fall-intrinsics -std=f95" }
3 program save_2
4 implicit none
5 integer i
6 integer foo1, foo2, foo3, foo4
7 do i=1,10
8 if (foo1().ne.i) then
9 call abort
10 end if
11 if (foo2().ne.i) then
12 call abort
13 end if
14 if (foo3().ne.i) then
15 call abort
16 end if
17 if (foo4().ne.i) then
18 call abort
19 end if
20 end do
21 end program save_2
23 integer function foo1 ()
24 integer j
25 save
26 save ! { dg-error "Blanket SAVE" }
27 data j /0/
28 j = j + 1
29 foo1 = j
30 end function foo1
32 integer function foo2 ()
33 integer j
34 save j
35 save j ! { dg-error "Duplicate SAVE" }
36 data j /0/
37 j = j + 1
38 foo2 = j
39 end function foo2
41 integer function foo3 ()
42 integer j
43 save
44 save j ! { dg-error "SAVE statement" }
45 data j /0/
46 j = j + 1
47 foo3 = j
48 end function foo3
50 integer function foo4 ()
51 integer j ! { dg-error "Duplicate SAVE" }
52 save j
53 save
54 data j /0/
55 j = j + 1
56 foo4 = j
57 end function foo4