| 1 |
! Program to test static variable initialization |
| 2 |
! returns the parameter from the previous invocation, or 42 on the first call. |
| 3 |
function test (parm) |
| 4 |
implicit none |
| 5 |
integer test, parm |
| 6 |
integer :: val = 42 |
| 7 |
|
| 8 |
test = val |
| 9 |
val = parm |
| 10 |
end function |
| 11 |
|
| 12 |
program intializer |
| 13 |
implicit none |
| 14 |
integer test |
| 15 |
character(11) :: c = "Hello World" |
| 16 |
character(15) :: d = "Teststring" |
| 17 |
integer, dimension(3) :: a = 1 |
| 18 |
|
| 19 |
if (any (a .ne. 1)) STOP 1 |
| 20 |
if (test(11) .ne. 42) STOP 2 |
| 21 |
! The second call should return |
| 22 |
if (test(0) .ne. 11) STOP 3 |
| 23 |
|
| 24 |
if (c .ne. "Hello World") STOP 4 |
| 25 |
if (d .ne. "Teststring") STOP 5 |
| 26 |
end program |