2017-12-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / import9.f90
blob4ed5cdf88e3deba64888d02f33ac6c87a67d1a5c
1 ! { dg-do compile }
3 ! PR fortran/48821
5 ! Contributed by Daniel Carrera
8 contains
9 pure subroutine rk4_vec(t, Y, dY, h)
10 real, intent(inout) :: t, Y(:)
11 real, intent(in) :: h
12 real, dimension(size(Y)) :: k1, k2, k3, k4
14 interface
15 pure function dY(t0, y0)
16 import :: Y
17 real, intent(in) :: t0, y0(size(Y))
18 real :: dY(size(y0))
19 end function
20 end interface
22 k1 = dY(t, Y)
23 k2 = dY(t + h/2, Y + k1*h/2)
24 k3 = dY(t + h/2, Y + k2*h/2)
25 k4 = dY(t + h , Y + k3*h)
27 Y = Y + (k1 + 2*k2 + 2*k3 + k4) * h/6
28 t = t + h
29 end subroutine
30 end