program doloop_04
implicit none
integer :: i, j, k

j = 0
k = 2
do i = 1, 10, k
    j = j + i
end do
if (j /= 25) then
    error stop
end if
print *, j

j = 0
k = -2
do i = 10, 1, k
    j = j + i
end do
if (j /= 30) then
    error stop
end if
print *, j

j = 0
a: do i = 1, 10
    j = j + i
    if (i == 2) then
        exit a
    end if
end do a
if (j /= 3) then
    error stop
end if

j = 0
b: do i = 1, 10, 2
    j = j + i
    if (i == 3) then
        exit b
    end if
end do b
if (j /= 4) then
    error stop
end if

j = 0
i = 1
c: do
    j = j + i
    if (i == 2) then
        exit c
    end if
    i = i + 1
end do c
if (j /= 3) then
    error stop
end if

!test-issue 746

k = 2
do i = 1, 10, k
    100 continue
end do

end program doloop_04
