I have written a function that reads an array and returns it:
function read_array(f) result (arr) implicit none integer, intent(in) :: f integer,