(4) Consider a parameterized derived type “container” toward matrices and associated vectors, that provides a surefire and efficient method for bounds matching. Intel oneAPI IFORT is now quite functional here, so appears to be NAG Fortran 7.0.
..
type :: mat_t(n,m) ! may be just 'n' for square matrices
integer, len :: n, m
real :: xmat(n,m)
real :: yvec(n)
integer :: iuse(n)
..
contains
subroutine foo( this, luse )
type(mat_t(n=*,m=*)), intent(inout) :: this
logical, intent(in), optional :: luse
! No bounds checking necessary here
if ( present(luse) ) then
if ( luse ) then ! use this%iuse in the instructions
..