summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_pack.f90
blob: 565446e4e8b77c82ab30b88e6e876ad0379792a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
! Program to test the PACK intrinsic
program intrinsic_pack
   integer, dimension(3, 3) :: a
   integer, dimension(6) :: b

   a = reshape ((/0, 0, 0, 0, 9, 0, 0, 0, 7/), (/3, 3/))
   b = 0
   b(1:6:3) = pack (a, a .ne. 0);
   if (any (b(1:6:3) .ne. (/9, 7/))) call abort
   b = pack (a(2:3, 2:3), a(2:3, 2:3) .ne. 0, (/1, 2, 3, 4, 5, 6/));
   if (any (b .ne. (/9, 7, 3, 4, 5, 6/))) call abort
end program