1 ! RUN: %python %S/test_folding.py %s %flang_fc1
2 ! Tests folding of UNPACK (valid cases)
4 integer, parameter :: vector(*) = [1, 2, 3, 4]
5 integer, parameter :: field(2,3) = reshape([(-j
,j
=1,6)], shape(field
))
6 logical, parameter :: mask(*,*) = reshape([.false
., .true
., .true
., .false
., .false
., .true
.], shape(field
))
7 logical, parameter :: test_unpack_1
= all(unpack(vector
, mask
, 0) == reshape([0,1,2,0,0,3], shape(mask
)))
8 logical, parameter :: test_unpack_2
= all(unpack(vector
, mask
, field
) == reshape([-1,1,2,-4,-5,3], shape(mask
)))