Fortran 95 has the following constraint in section 8.1.4.1.1 :
Constraint: If the do-stmt is a label-do-stmt, the corresponding end-do shall be identified with the same label.
The example source code below is in violation of this rule, yet FTN95 does not catch the syntax error.
subroutine tst(vel,n)
implicit none
integer, intent(in) :: n
real, intent(in) :: vel(n,n)
integer :: nfound, x, y, i, j
real u(2)
nfound = 0
x = 7; y = 5
dw: do while (nfound < 10)
call random_number(u)
u = 5*u + 2.5
do i = 1,n
do j = 1,n
if (vel(j,i) > 25.3 .and. (u(1) > x .or. u(2) < y)) cycle dw
end do
end do
end do ! dw (this label name is required)
print *, 'Ten qualified entries found'
return
end subroutine
Gfortran gives the message
Error: Expected block name of 'dw' in END DO statement at (1)