1! Program to test arrays with the save attribute
2program testarray
3   implicit none
4   integer, save, dimension (6, 5) :: a, b
5
6   a = 0
7   a(1, 1) = 42
8   a(6, 5) = 43
9   b(:,1:5) = a
10
11   call fn (a)
12contains
13subroutine fn (a)
14   implicit none
15   integer, dimension(1:, 1:) :: a
16   integer, dimension(2) :: b
17
18   b = ubound (a)
19   if (any (b .ne. (/6, 5/))) STOP 1
20   if (a(1, 1) .ne. 42) STOP 2
21   if (a(6, 5) .ne. 43) STOP 3
22end subroutine
23end program
24
25