1! Program to test FORALL with pointer assignment inside it. 2program forall_5 3 type element 4 integer, pointer, dimension(:)::p 5 end type 6 7 type (element) q(5) 8 integer, target, dimension(25)::t 9 10 n = 5 11 do i = 1,5 12 q(i)%p => t((i-1)*n + 1:i*n) 13 enddo 14 15 forall (i = 2:5) 16 q(i)%p => q(i-1)%p 17 end forall 18 19 do i = 1, 25 20 t(i) = i 21 enddo 22 23 if (any(q(1)%p .ne. (/1,2,3,4,5/))) STOP 1 24 if (any(q(2)%p .ne. (/1,2,3,4,5/))) STOP 2 25 if (any(q(3)%p .ne. (/6,7,8,9,10/))) STOP 3 26 if (any(q(4)%p .ne. (/11,12,13,14,15/))) STOP 4 27 if (any(q(5)%p .ne. (/16,17,18,19,20/))) STOP 5 28end 29