Skip to content

COR010 missing-intent ​

warning enabled by default

A dummy argument has no intent.

Why ​

intent documents how a procedure uses each argument and lets the compiler reject writes to intent(in) data and reads of intent(out) data before definition. Without it, an argument the caller passes as a constant or expression can be modified, which is undefined behaviour. Dummy procedures are exempt (intent does not apply to them), and so are value dummies (the procedure works on a copy: the caller's actual argument cannot change).

Reported ​

fortran
subroutine scale(a, s)
  real :: a(:), s

Preferred ​

fortran
subroutine scale(a, s)
  real, intent(inout) :: a(:)
  real, intent(in)    :: s

Suppressing ​

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

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

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

References ​

Sections of the shipped knowledge packs behind this rule:

  • fortran-std:ch08-attribute-declarations#core-idea (fobis kb show fortran-std:ch08-attribute-declarations#core-idea)

Equivalent ​

Fortitude rule C061 (see Lint Rules).