Refactoring code into a subroutine

The Cray compiler supports it (along with most of F2018). Intel claims ifort supports 2018. Are you using an old version? A newish Intel compiler seems to work:

% /opt/intel/oneapi/compiler/2021.1.1/mac/bin/intel64/ifort -c test.f90
% cat test.f90
implicit none (type,external)
end program
%