COR021 pointer-initialisation-in-declaration
warning enabled by defaultA procedure's local pointer is initialised in its declaration (=> null()), which implies save.
Why
Pointer initialisation in a declaration gives the pointer the SAVE attribute: after the first call it keeps whatever association the previous call left, possibly to deallocated memory. Nullify it with an executable statement instead.
Reported
fortran
real, pointer :: p(:) => null()Preferred
fortran
real, pointer :: p(:)
nullify(p)Suppressing
For one occurrence, with the reason on the same line (or alone on the line before the statement):
fortran
! fobis: ignore[COR021] <why this occurrence is fine>For the whole project, ignore = COR021 in the fobos [lint] section.
Equivalent
Fortitude rule C082 (see Lint Rules).