6 ! Additional run-time checks for IS_CONTIGUOUS with assumed type/rank
7 program is_contiguous_2
9 real, allocatable
:: b(:,:)
10 real, pointer :: c(:,:)
11 integer, volatile :: k
15 if (fail_ar (b
, .true
.) ) stop 1
16 if (fail_ar (b(::1,::1), .true
.) ) stop 2
17 if (fail_ar (b(::2,::1), .false
.)) stop 3
18 if (fail_ar (b(::1,::2), .false
.)) stop 4
19 if (fail_ar (b(:10,:10), .true
. )) stop 5
20 if (fail_ar (b(: 9,:10), .false
.)) stop 6
21 if (fail_ar (b(2: ,: ), .false
.)) stop 7
22 if (fail_ar (b(: ,2: ), .true
. )) stop 8
23 if (fail_ar (b(k
: ,: ), .false
.)) stop 9
24 if (fail_ar (b(: ,k
: ), .true
. )) stop 10
25 if (fail_at (b(::1,k
: ), .true
. )) stop 11
26 if (fail_at (b(::k
,k
: ), .false
.)) stop 12
27 if (fail_at (b(10,k
) , .true
. )) stop 13
29 if (fail_ar (c
, .true
.) ) stop 14
31 if (fail_ar (c
, .false
.)) stop 15
32 associate (d
=> b(:,2:), e
=> b(::k
,:))
33 if (fail_ar (d
, .true
.) ) stop 16
34 if (fail_ar (e
, .false
.)) stop 17
37 pure
logical function fail_ar (x
, expect
) result (fail
)
38 real, dimension(..), intent(in
) :: x
! Assumed rank
39 logical, intent(in
) :: expect
40 fail
= is_contiguous (x
) .neqv
. expect
42 pure
logical function fail_at (x
, expect
) result (fail
)
43 type(*), dimension(..), intent(in
) :: x
! Assumed type/assumed rank
44 logical, intent(in
) :: expect
45 fail
= is_contiguous (x
) .neqv
. expect