Skip to content

OBS005 specific-intrinsic-name ​

warning enabled by default

A specific intrinsic name (dsqrt, dabs, amax1, float ...) instead of the generic one.

Why ​

Specific names fix the argument kind (dsqrt only accepts double precision), so changing the kind of a variable breaks or silently converts the call. The generic names (sqrt, abs, max, real) work for every kind. Specific names are obsolescent since Fortran 2018.

Reported ​

fortran
y = dsqrt(x) + float(n)

Preferred ​

fortran
y = sqrt(x) + real(n, kind(x))

Suppressing ​

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

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

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

References ​

Sections of the shipped knowledge packs behind this rule:

  • fortran-std:ch21-annex-b-deleted-obsolescent#obsolescent-features-b-3-still-legal-avoid-in-new-code (fobis kb show fortran-std:ch21-annex-b-deleted-obsolescent#obsolescent-features-b-3-still-legal-avoid-in-new-code)

Equivalent ​

Fortitude rule OB031 (see Lint Rules).