c: Fix up pointer types to may_alias structures [PR114493]
[official-gcc.git] / gcc / testsuite / gfortran.dg / interface_36.f90
blob503229134abe99d8e8eab4961ee1745037366331
1 ! { dg-do compile }
3 ! PR fortran/48800
5 ! Contributed by Daniel Carrera
7 pure function runge_kutta_step(t, r_, dr, h) result(res)
8 real, intent(in) :: t, r_(:), h
9 real, dimension(:), allocatable :: k1, k2, k3, k4, res
10 integer :: N
12 interface
13 pure function dr(t, r_) ! { dg-error "cannot have a deferred shape" }
14 real, intent(in) :: t, r_(:)
15 real :: dr(:)
16 end function
17 end interface
19 N = size(r_)
20 allocate(k1(N),k2(N),k3(N),k4(N),res(N))
22 k1 = dr(t, r_)
23 k2 = dr(t + h/2, r_ + k1*h/2)
24 k3 = dr(t + h/2, r_ + k2*h/2)
25 k4 = dr(t + h , r_ + k3*h)
27 res = r_ + (k1 + 2*k2 + 2*k3 + k4) * h/6
28 end function