COR061 multiple-allocations-with-stat
warning enabled by defaultOne allocate/deallocate with stat= handles several objects.
Why
When the statement fails, stat does not say which object failed, and the others may or may not have been allocated: the error handling cannot know what to clean up. Allocate one object per statement when checking stat.
Reported
fortran
allocate(a(n), b(n), stat=ierr)Preferred
fortran
allocate(a(n), stat=ierr)
...
allocate(b(n), stat=ierr)Suppressing
For one occurrence, with the reason on the same line (or alone on the line before the statement):
fortran
! fobis: ignore[COR061] <why this occurrence is fine>For the whole project, ignore = COR061 in the fobos [lint] section.
Equivalent
Fortitude rule C182 (see Lint Rules).