FOR004 function-result-component
error enabled by defaultA component of a function result is referenced directly: f(x)%c.
Why
Fortran does not allow a component (or a type-bound procedure) to be selected from a function reference: f(x)%c is not a valid designator. Some compilers accept it as an extension, others reject it or miscompile it. Assign the result to a variable, or use associate (r => f(x)) and then r%c.
Reported
fortran
n = grid_of(level)%niPreferred
fortran
associate (grid => grid_of(level))
n = grid%ni
end associateSuppressing
For one occurrence, with the reason on the same line (or alone on the line before the statement):
fortran
! fobis: ignore[FOR004] <why this occurrence is fine>For the whole project, ignore = FOR004 in the fobos [lint] section.
References
Sections of the shipped knowledge packs behind this rule:
hpc-practice:fortran-practice#function-result-component-access-chained-func-component-is-i(fobis kb show hpc-practice:fortran-practice#function-result-component-access-chained-func-component-is-i)