Skip to content

OBS011 labelled-do-loop ​

warning enabled by default

A labelled do 10 i = ... loop.

Why ​

The label form of DO is obsolescent since Fortran 2018. do ... end do (optionally with a construct name) states the loop's extent without a label to match.

Reported ​

fortran
do 10 i = 1, n
  a(i) = 0.0
10 continue

Preferred ​

fortran
do i = 1, n
  a(i) = 0.0
end do

Suppressing ​

For one occurrence, with the reason on the same line (or alone on the line before the statement):

fortran
! fobis: ignore[OBS011] <why this occurrence is fine>

For the whole project, ignore = OBS011 in the fobos [lint] section.

Equivalent ​

Fortitude rule OB091 (see Lint Rules).