1! { dg-do run }
2!
3! PR fortran/45424
4! PR fortran/48820
5!
6! Run-time checks for IS_CONTIGUOUS
7
8implicit none
9integer, pointer :: a(:), b(:,:)
10integer :: i, j, k, s
11
12allocate(a(5), b(10,10))
13
14s = 1
15if (.true. .neqv. is_contiguous (a(::s))) stop 1
16s = 2
17if (.false. .neqv. is_contiguous (a(::s))) stop 2
18i=5; j=7
19if (.true. .neqv. is_contiguous (b(1:i*2,1:j))) stop 3
20if (.false. .neqv. is_contiguous (b(1:i,1:j))) stop 4
21i=5; j=5; s=1
22if (.false. .neqv. is_contiguous (b(i:5:s,i:j*2))) stop 5
23
24! The following test zero-sized arrays. For the standard, they
25! are regarded as noncontiguous. However, gfortran in line with
26! other compilers only checks for the strides and thus prints
27! .true. or .false. depending on this setting.
28
29s = 4
30if (.false. .neqv. is_contiguous (a(2:1:s))) stop 6
31s = 1
32if (.true. .neqv. is_contiguous (a(2:1:s))) stop 7
33end
34