Skip to content

OBS006 computed-go-to ​

warning enabled by default

A computed go to (l1, l2, ...), i.

Why ​

A computed GO TO jumps to the i-th label of a list; it is obsolescent since Fortran 95. A select case construct expresses the same choice with structure.

Reported ​

fortran
go to (10, 20, 30) mode

Preferred ​

fortran
select case (mode)
case (1)
  ...
end select

Suppressing ​

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

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

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

Equivalent ​

Fortitude rule OB041 (see Lint Rules).