1!program to test nested forall construct and forall mask 2program test 3 implicit none 4 integer a(4,4) 5 integer i, j 6 7 do i=1,4 8 do j=1,4 9 a(j,i) = j-i 10 enddo 11 enddo 12 forall (i=2:4, a(1,i).GT.-2) 13 forall (j=1:4, a(j,2).GT.0) 14 a(j,i) = a(j,i-1) 15 end forall 16 end forall 17 if (any (a.ne.reshape ((/0,1,2,3,-1,0,2,3,-2,-1,0,1,-3,-2,-1,0/),& 18 (/4,4/)))) STOP 1 19end 20 21