brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.6 KiB · 864f38b Raw
84 lines · plain
1! RUN: %python %S/test_folding.py %s %flang_fc12! Test folding of IS_CONTIGUOUS3 4module m5  real, target :: hosted(2)6  integer, parameter :: cst(2,2) = reshape([1, 2, 3, 4], shape(cst))7  integer, parameter :: empty_cst(2,0) = reshape([1], shape(empty_cst))8  integer :: n, m9  logical, parameter :: test_param1 = is_contiguous(cst(:,1))10  logical, parameter :: test_param2 = is_contiguous(cst(1,:))11  logical, parameter :: test_param3 = is_contiguous(cst(:,n))12  logical, parameter :: test_param4 = is_contiguous(cst(n,:))13  logical, parameter :: test_param5 = is_contiguous(empty_cst(n,-1:n:2))14 contains15  function f()16    real, pointer, contiguous :: f(:)17    f => hosted18  end function19  subroutine test(arr1, arr2, arr3, mat, alloc, alch)20    real, intent(in) :: arr1(:), arr2(10), mat(10, 10)21    real, intent(in), contiguous :: arr3(:)22    real, allocatable :: alloc(:)23    real :: scalar24    character(5) charr(5)25    character(1) char1(5)26    character(0) char0(5)27    character(*) alch(5)28    integer(kind=merge(1,-1,       is_contiguous(0)))               t0129    integer(kind=merge(1,-1,       is_contiguous(scalar)))          t0230    integer(kind=merge(1,-1,       is_contiguous(scalar + scalar))) t0331    integer(kind=merge(1,-1,       is_contiguous([0, 1, 2])))       t0432    integer(kind=merge(1,-1,       is_contiguous(arr1 + 1.0)))      t0533    integer(kind=merge(1,-1,       is_contiguous(arr2)))            t0634    integer(kind=merge(1,-1,       is_contiguous(mat)))             t0735    integer(kind=merge(1,-1,       is_contiguous(mat(1:10,1))))     t0836    integer(kind=merge(1,-1,       is_contiguous(arr2(1:10:1))))    t0937    integer(kind=merge(1,-1, .not. is_contiguous(arr2(1:10:2))))    t1038    integer(kind=merge(1,-1,       is_contiguous(arr3)))            t1139    integer(kind=merge(1,-1, .not. is_contiguous(arr3(1:10:2))))    t1240    integer(kind=merge(1,-1,       is_contiguous(f())))             t1341    integer(kind=merge(1,-1,       is_contiguous(alloc)))           t1442    integer(kind=merge(1,-1,       is_contiguous(charr(:)(:))))     t1543    integer(kind=merge(1,-1,       is_contiguous(charr(1)(2:3))))   t1644    integer(kind=merge(1,-1,       is_contiguous(charr(:)(1:))))    t1745    integer(kind=merge(1,-1,       is_contiguous(charr(:)(3:2))))   t1846    integer(kind=merge(1,-1,       is_contiguous(charr(:)(1:5))))   t1947    integer(kind=merge(1,-1, .not. is_contiguous(charr(:)(1:4))))   t2048    integer(kind=merge(1,-1,       is_contiguous(char1(:)(n:m))))   t2149    integer(kind=merge(1,-1, .not. is_contiguous(char1(1:5:2)(n:m)))) t2250    integer(kind=merge(1,-1,       is_contiguous(char0(:)(n:m))))   t2351    integer(kind=merge(1,-1,       is_contiguous(char0(1:5:2)(n:m)))) t2452    integer(kind=merge(1,-1,       is_contiguous(alch(:)(:))))      t2553    associate (x => arr2)54      block55        integer(kind=merge(1,-1,is_contiguous(x))) n56      end block57    end associate58    associate (x => arr2(1:10:2))59      block60        integer(kind=merge(1,-1,.not. is_contiguous(x))) n61      end block62    end associate63    associate (x => arr3)64      block65        integer(kind=merge(1,-1,is_contiguous(x))) n66      end block67    end associate68    associate (x => arr3(1:10:2))69      block70        integer(kind=merge(1,-1,.not. is_contiguous(x))) n71      end block72    end associate73  end subroutine74  subroutine test2(x, vec)75    type t76      integer :: i77    end type78    type(t) :: x(100)79    integer(8) :: vec(10)80    integer(kind=merge(1,-1, .not. is_contiguous(x(1:50:2)%i)))    t0181    integer(kind=merge(1,-1, .not. is_contiguous(x(vec)%i)))       t0282  end subroutine83end module84