Skip to content

COR011 assumed-size ​

warning enabled by default

A dummy array is assumed-size (a(*), a(n,*)).

Why ​

An assumed-size array carries no extent for its last dimension: the procedure cannot check bounds, whole-array operations on it are forbidden, and the compiler cannot verify the caller. Use an assumed-shape (a(:)) or explicit-shape (a(n)) dummy instead. Procedures with bind(c) are exempt: there an assumed-size array (e.g. character(c_char) :: s(*)) is the idiomatic C array.

Reported ​

fortran
real, intent(in) :: a(*)

Preferred ​

fortran
real, intent(in) :: a(:)

Suppressing ​

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

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

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

References ​

Sections of the shipped knowledge packs behind this rule:

  • fortran-std:ch08-attribute-declarations#array-dummy-bounds-the-rebasing-trap (fobis kb show fortran-std:ch08-attribute-declarations#array-dummy-bounds-the-rebasing-trap)

Equivalent ​

Fortitude rule C071 (see Lint Rules).