summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/do_check_5.f90
blob: 3df7b14f0ebfd604411a5e8c02960acb3fd678ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
! { dg-do compile }
! 
! PR/fortran 38432
! DO-loop compile-time checks
!
implicit none
integer :: i
real :: r
do i = 1, 0 ! { dg-warning "executed zero times" }
end do

do i = 1, -1, 1 ! { dg-warning "executed zero times" }
end do

do i = 1, 2, -1 ! { dg-warning "executed zero times" }
end do

do i = 1, 2, 0 ! { dg-error "cannot be zero" }
end do

do r = 1, 0 ! { dg-warning "must be integer|executed zero times" }
end do

do r = 1, -1, 1 ! { dg-warning "must be integer|executed zero times" }
end do

do r = 1, 2, -1 ! { dg-warning "must be integer|executed zero times" }
end do

do r = 1, 2, 0
end do
! { dg-warning "must be integer" "loop var" { target *-*-* } 30 }
! { dg-error "cannot be zero" "loop step" { target *-*-* } 30 }
end