2021-09-06 21:54:33 +08:00
|
|
|
! RUN: %python %S/test_folding.py %s %flang_fc1
|
2020-01-08 05:39:42 +08:00
|
|
|
! Test folding of IS_CONTIGUOUS on simply contiguous items (9.5.4)
|
|
|
|
! When IS_CONTIGUOUS() is constant, it's .TRUE.
|
|
|
|
|
|
|
|
module m
|
|
|
|
real, target :: hosted(2)
|
|
|
|
contains
|
|
|
|
function f()
|
|
|
|
real, pointer, contiguous :: f(:)
|
|
|
|
f => hosted
|
|
|
|
end function
|
2021-11-29 15:27:16 +08:00
|
|
|
subroutine test(arr1, arr2, arr3, mat, alloc)
|
2020-01-08 05:39:42 +08:00
|
|
|
real, intent(in) :: arr1(:), arr2(10), mat(10, 10)
|
|
|
|
real, intent(in), contiguous :: arr3(:)
|
2021-11-29 15:27:16 +08:00
|
|
|
real, allocatable :: alloc(:)
|
2020-01-08 05:39:42 +08:00
|
|
|
real :: scalar
|
2021-01-27 00:20:57 +08:00
|
|
|
logical, parameter :: test_isc01 = is_contiguous(0)
|
|
|
|
logical, parameter :: test_isc02 = is_contiguous(scalar)
|
|
|
|
logical, parameter :: test_isc03 = is_contiguous(scalar + scalar)
|
|
|
|
logical, parameter :: test_isc04 = is_contiguous([0, 1, 2])
|
|
|
|
logical, parameter :: test_isc05 = is_contiguous(arr1 + 1.0)
|
|
|
|
logical, parameter :: test_isc06 = is_contiguous(arr2)
|
|
|
|
logical, parameter :: test_isc07 = is_contiguous(mat)
|
|
|
|
logical, parameter :: test_isc08 = is_contiguous(mat(1:10,1))
|
|
|
|
logical, parameter :: test_isc09 = is_contiguous(arr2(1:10:1))
|
|
|
|
logical, parameter :: test_isc10 = is_contiguous(arr3)
|
|
|
|
logical, parameter :: test_isc11 = is_contiguous(f())
|
2021-11-29 15:27:16 +08:00
|
|
|
logical, parameter :: test_isc12 = is_contiguous(alloc)
|
2020-01-08 05:39:42 +08:00
|
|
|
end subroutine
|
|
|
|
end module
|