Skip to content

COR082 missing-action-specifier ​

warning opt-in

An open statement has no action= specifier.

Why ​

Without action= the file is opened with a processor-dependent action, usually read-write: an input file can be modified by mistake, and opening a read-only file may fail. State the intent with action='read', 'write' or 'readwrite'.

Reported ​

fortran
open(newunit=u, file='mesh.dat')

Preferred ​

fortran
open(newunit=u, file='mesh.dat', action='read')

Suppressing ​

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

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

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

Equivalent ​

Fortitude rule C043 (see Lint Rules).