Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gfortran.dg / intrinsic_unpack_3.f90
blob4a4443facf5a73e7dd50b62af243c0531e3b5dd4
1 ! { dg-do run }
2 ! { dg-require-effective-target fortran_large_int }
3 ! Program to test the UNPACK intrinsic for a long integer type
4 program intrinsic_unpack
5 implicit none
6 integer,parameter :: k = selected_int_kind (range (0_8) + 1)
7 integer(kind=k), dimension(3, 3) :: ak, bk
8 logical, dimension(3, 3) :: mask
9 character(len=100) line1, line2
10 integer i
12 mask = reshape ((/.false.,.true.,.false.,.true.,.false.,.false.,&
13 &.false.,.false.,.true./), (/3, 3/));
15 ak = reshape ((/1, 0, 0, 0, 1, 0, 0, 0, 1/), (/3, 3/));
16 bk = unpack ((/2_k, 3_k, 4_k/), mask, ak)
17 if (any (bk .ne. reshape ((/1, 2, 0, 3, 1, 0, 0, 0, 4/), (/3, 3/)))) &
18 call abort
19 write (line1,'(10I4)') bk
20 write (line2,'(10I4)') unpack((/2_k, 3_k, 4_k/), mask, ak)
21 if (line1 .ne. line2) call abort
22 bk = -1
23 bk = unpack ((/2_k, 3_k, 4_k/), mask, 0_k)
24 if (any (bk .ne. reshape ((/0, 2, 0, 3, 0, 0, 0, 0, 4/), (/3, 3/)))) &
25 call abort
27 end program