2 ! { dg-require-effective-target fortran_large_int }
3 ! Program to test the UNPACK intrinsic for a long integer type
4 program intrinsic_unpack
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
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/)))) &
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
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/)))) &