1! Program to test array arguments which depend on other array arguments
2program arrayarg2
3   integer, dimension(5) :: a, b
4
5   a = (/1, 2, 3, 4, 5/)
6   b = (/2, 3, 4, 5, 6/)
7
8   call test (a, b)
9
10   if (any (b .ne. (/4, 7, 10, 13, 16/))) STOP 1
11contains
12subroutine test (x1, x2)
13   implicit none
14   integer, dimension(1:), intent(in) :: x1
15   integer, dimension(1:), intent(inout) :: x2
16   integer, dimension(1:size(x1)) :: x3
17
18   x3 = x1 * 2
19   x2 = x2 + x3
20end subroutine test
21end program
22