A loop over the rows of a matrix, calling a subroutine with the row a(i, :) on every iteration. Right answer, embarrassing speed. The time goes into copying, not arithmetic.
subroutine scale(v, n)
integer, intent(in) :: n
real, intent(inout) :: v(n)
v = 2.0 * v
end subroutine scale
! caller, a is m by n
do i = 1, m
call scale(a(i, :), n)
end do
An explicit-shape dummy like v(n) assumes one contiguous run of memory. A row in Fortran isn't contiguous, neighbouring elements sit a whole column apart. So gfortran makes a temporary array on every call, copies the row in, and copies it back out after the call. Two copies per iteration, and nothing says so by default.
-Warray-temporaries points at the spot at compile time, and -fcheck=array-temps reports the temporary at run time. Both are in the debug build now. Whether to rewrite every such subroutine with v(:) or change the loop order is still open.