Merge reload-branch up to revision 101000
[official-gcc.git] / gcc / testsuite / gfortran.fortran-torture / execute / intrinsic_unpack.f90
blob88f09c321b4d7c065dddd43bd755eccb87ec3060
1 ! Program to test the UNPACK intrinsic
2 program intrinsic_unpack
3 integer, dimension(3, 3) :: a, b
4 logical, dimension(3, 3) :: mask;
5 character(len=50) line1, line2
6 integer i
8 mask = reshape ((/.false.,.true.,.false.,.true.,.false.,.false.,&
9 &.false.,.false.,.true./), (/3, 3/));
10 a = reshape ((/1, 0, 0, 0, 1, 0, 0, 0, 1/), (/3, 3/));
11 b = unpack ((/2, 3, 4/), mask, a)
12 if (any (b .ne. reshape ((/1, 2, 0, 3, 1, 0, 0, 0, 4/), (/3, 3/)))) &
13 call abort
14 write (line1,'(10I4)') b
15 write (line2,'(10I4)') unpack((/2, 3, 4/), mask, a)
16 if (line1 .ne. line2) call abort
17 b = -1
18 b = unpack ((/2, 3, 4/), mask, 0)
19 if (any (b .ne. reshape ((/0, 2, 0, 3, 0, 0, 0, 0, 4/), (/3, 3/)))) &
20 call abort
21 end program