1 ! Program to test the PACK intrinsic
3 integer, dimension(3, 3) :: a
4 integer, dimension(6) :: b
6 a = reshape ((/0, 0, 0, 0, 9, 0, 0, 0, 7/), (/3, 3/))
8 b(1:6:3) = pack (a, a .ne. 0);
9 if (any (b(1:6:3) .ne. (/9, 7/))) call abort
10 b = pack (a(2:3, 2:3), a(2:3, 2:3) .ne. 0, (/1, 2, 3, 4, 5, 6/));
11 if (any (b .ne. (/9, 7, 3, 4, 5, 6/))) call abort