Skip to content

STY010 inconsistent-array-declaration ​

warning enabled by default

A declaration has a dimension attribute and an entity with its own shape.

Why ​

In real, dimension(5) :: x, y(2) the attribute does not apply to y: a reader sees dimension(5) and assumes every entity has that shape. Declare entities with different shapes in separate statements.

Reported ​

fortran
real, dimension(5) :: x, y(2)

Preferred ​

fortran
real, dimension(5) :: x
real :: y(2)

Suppressing ​

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

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

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

Equivalent ​

Fortitude rule S261 (see Lint Rules).