PR tree-optimization/86415 - strlen() not folded for substrings within constant arrays
[official-gcc.git] / gcc / testsuite / gfortran.fortran-torture / execute / intrinsic_pack.f90
blob96831a8de82fb1a9a781ff142e0ad239e1f29888
1 ! Program to test the PACK intrinsic
2 program intrinsic_pack
3 integer, parameter :: val(9) = (/0,0,0,0,9,0,0,0,7/)
4 integer, dimension(3, 3) :: a
5 integer, dimension(6) :: b
7 a = reshape (val, (/3, 3/))
8 b = 0
9 b(1:6:3) = pack (a, a .ne. 0);
10 if (any (b(1:6:3) .ne. (/9, 7/))) STOP 1
11 b = pack (a(2:3, 2:3), a(2:3, 2:3) .ne. 0, (/1, 2, 3, 4, 5, 6/));
12 if (any (b .ne. (/9, 7, 3, 4, 5, 6/))) STOP 2
14 call tests_with_temp()
15 contains
16 subroutine tests_with_temp
17 ! A few tests which involve a temporary
18 if (any (pack(a, a.ne.0) .ne. (/9, 7/))) STOP 3
19 if (any (pack(a, .true.) .ne. val)) STOP 4
20 if (size(pack (a, .false.)) .ne. 0) STOP 5
21 if (any (pack(a, .false., (/1,2,3/)).ne. (/1,2,3/))) STOP 6
23 end subroutine tests_with_temp
24 end program