function func4(x) result(f) real(rk), intent(in) :: x real(rk) :: f f = x**2 + 2.0_rk*x end function func4