2011-05-23 Tom de Vries <tom@codesourcery.com>
[official-gcc.git] / gcc / testsuite / gfortran.dg / intrinsic_pack_3.f90
blobd559e911207ee88a3c897274be97b6c5598bff97
1 ! { dg-do run }
2 ! { dg-require-effective-target fortran_large_int }
3 ! Take the pack intrinsic through its paces, with all types that are
4 ! normally accessible.
5 program main
6 implicit none
7 integer,parameter :: k = selected_int_kind (range (0_8) + 1)
8 integer :: i
9 integer(kind=k), dimension(3,3) :: ik
10 integer(kind=k), dimension(9) :: vik
11 integer(kind=k), dimension(9) :: rik
13 vik = (/(i+10,i=1,9)/)
14 ik = reshape((/1_k, -1_k, 2_k, -2_k, 3_k, -3_k, 4_k, -4_k, 5_k/), shape(ik))
15 rik = pack(ik,ik>0,vik)
16 if (any(rik /= (/1_k, 2_k, 3_k, 4_k, 5_k, 16_k, 17_k, 18_k, 19_k/))) &
17 & call abort
20 end program main