annotate gcc/testsuite/gfortran.dg/array_constructor_11.f90 @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ! Like array_constructor_6.f90, but check iterators with non-default stride,
kono
parents:
diff changeset
2 ! including combinations which lead to zero-length vectors.
kono
parents:
diff changeset
3 ! { dg-do run }
kono
parents:
diff changeset
4 ! { dg-options "-Wzerotrip" }
kono
parents:
diff changeset
5 program main
kono
parents:
diff changeset
6 implicit none
kono
parents:
diff changeset
7 call build (77)
kono
parents:
diff changeset
8 contains
kono
parents:
diff changeset
9 subroutine build (order)
kono
parents:
diff changeset
10 integer :: order, i, j
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 call test (1, 11, 3, (/ (i, i = 1, 11, 3) /))
kono
parents:
diff changeset
13 call test (3, 20, 2, (/ (i, i = 3, 20, 2) /))
kono
parents:
diff changeset
14 call test (4, 0, 11, (/ (i, i = 4, 0, 11) /)) ! { dg-warning "will be executed zero times" }
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 call test (110, 10, -3, (/ (i, i = 110, 10, -3) /))
kono
parents:
diff changeset
17 call test (200, 20, -12, (/ (i, i = 200, 20, -12) /))
kono
parents:
diff changeset
18 call test (29, 30, -6, (/ (i, i = 29, 30, -6) /)) ! { dg-warning "will be executed zero times" }
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 call test (1, order, 3, (/ (i, i = 1, order, 3) /))
kono
parents:
diff changeset
21 call test (order, 1, -3, (/ (i, i = order, 1, -3) /))
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 ! Triggers compile-time iterator calculations in trans-array.c
kono
parents:
diff changeset
24 call test (1, 1000, 2, (/ (i, i = 1, 1000, 2), (i, i = order, 0, 1) /))
kono
parents:
diff changeset
25 call test (1, 0, 3, (/ (i, i = 1, 0, 3), (i, i = order, 0, 1) /)) ! { dg-warning "will be executed zero times" }
kono
parents:
diff changeset
26 call test (1, 2000, -5, (/ (i, i = 1, 2000, -5), (i, i = order, 0, 1) /)) ! { dg-warning "will be executed zero times" }
kono
parents:
diff changeset
27 call test (3000, 99, 4, (/ (i, i = 3000, 99, 4), (i, i = order, 0, 1) /)) ! { dg-warning "will be executed zero times" }
kono
parents:
diff changeset
28 call test (400, 77, -39, (/ (i, i = 400, 77, -39), (i, i = order, 0, 1) /))
kono
parents:
diff changeset
29
kono
parents:
diff changeset
30 do j = -10, 10
kono
parents:
diff changeset
31 call test (order + j, order, 5, (/ (i, i = order + j, order, 5) /))
kono
parents:
diff changeset
32 call test (order + j, order, -5, (/ (i, i = order + j, order, -5) /))
kono
parents:
diff changeset
33 end do
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 end subroutine build
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 subroutine test (from, to, step, values)
kono
parents:
diff changeset
38 integer, dimension (:) :: values
kono
parents:
diff changeset
39 integer :: from, to, step, last, i
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 last = 0
kono
parents:
diff changeset
42 do i = from, to, step
kono
parents:
diff changeset
43 last = last + 1
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
44 if (values (last) .ne. i) STOP 1
111
kono
parents:
diff changeset
45 end do
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
46 if (size (values, dim = 1) .ne. last) STOP 2
111
kono
parents:
diff changeset
47 end subroutine test
kono
parents:
diff changeset
48 end program main