| 1 |
! { dg-do compile } |
| 2 |
! { dg-options " -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 |
STOP 1 |
| 10 |
end if |
| 11 |
if (foo2().ne.i) then |
| 12 |
STOP 2 |
| 13 |
end if |
| 14 |
if (foo3().ne.i) then |
| 15 |
STOP 3 |
| 16 |
end if |
| 17 |
if (foo4().ne.i) then |
| 18 |
STOP 4 |
| 19 |
end if |
| 20 |
end do |
| 21 |
end program save_2 |
| 22 |
|
| 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 |
| 31 |
|
| 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 |
| 40 |
|
| 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 |
| 49 |
|
| 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 |