Debian Codegraph @

gcc/testsuite/gfortran.dg/is_contiguous_1.f90

raw
1 ! { dg-do run }
2 !
3 ! PR fortran/45424
4 ! PR fortran/48820
5 !
6 ! Run-time checks for IS_CONTIGUOUS
7
8 implicit none
9 integer, pointer :: a(:), b(:,:)
10 integer :: i, j, k, s
11
12 allocate(a(5), b(10,10))
13
14 s = 1
15 if (.true. .neqv. is_contiguous (a(::s))) stop 1
16 s = 2
17 if (.false. .neqv. is_contiguous (a(::s))) stop 2
18 i=5; j=7
19 if (.true. .neqv. is_contiguous (b(1:i*2,1:j))) stop 3
20 if (.false. .neqv. is_contiguous (b(1:i,1:j))) stop 4
21 i=5; j=5; s=1
22 if (.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
29 s = 4
30 if (.false. .neqv. is_contiguous (a(2:1:s))) stop 6
31 s = 1
32 if (.true. .neqv. is_contiguous (a(2:1:s))) stop 7
33 end