1! Program to test assumed size arrays 2subroutine test2(p) 3 integer, dimension(2, *) :: p 4 5 if (any (p(:, 1:3) .ne. reshape((/1, 2, 4, 5, 7, 8/), (/2, 3/)))) & 6 call abort () 7end subroutine 8 9program assumed_size 10 integer, dimension (3, 3) :: a 11 external test2 12 13 a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/)) 14 15 call test1(a, (/1, 2, 3, 4, 5, 6/)) 16 if (a(1,1) .ne. 0) call abort 17 a(1, 1) = 1 18 call test1(a(1:2, :), (/1, 2, 4, 5, 7, 8/)) 19 if (a(1,1) .ne. 0) call abort 20 a(1, 1) = 1 21 call test1(a(3:1:-1, :), (/3, 2, 1, 6, 5, 4/)) 22 if (a(3,1) .ne. 0) call abort 23 a(3, 1) = 3 24 call test1(a(:, 2:3), (/4, 5, 6, 7, 8, 9/)) 25 if (a(1, 2) .ne. 0) call abort 26 a(1, 2) = 4 27 28 call test2(a(1:2, :)) 29 call test2((/1, 2, 4, 5, 7, 8/)) 30contains 31subroutine test1(p, q) 32 integer, dimension(*) :: p 33 integer, dimension(1:) :: q 34 35 if (any (p(1:size(q)) .ne. q)) call abort () 36 p(1) = 0 37end subroutine 38 39end program 40