2011-05-23 Tom de Vries <tom@codesourcery.com>
[official-gcc.git] / gcc / testsuite / gfortran.dg / array_function_1.f90
blob281ae88b852b7dcae8e1241ff4781dec73f76e51
1 ! { dg-do run }
2 ! PR fortran/30720
3 program array_function_1
4 integer :: a(5), b, l, u
5 l = 4
6 u = 2
8 a = (/ 1, 2, 3, 4, 5 /)
10 b = f(a(l:u) - 2)
11 if (b /= 0) call abort
13 b = f(a(4:2) - 2)
14 if (b /= 0) call abort
16 b = f(a(u:l) - 2)
17 if (b /= 3) call abort
19 b = f(a(2:4) - 2)
20 if (b /= 3) call abort
22 contains
23 integer function f(x)
24 integer, dimension(:), intent(in) :: x
25 f = sum(x)
26 end function
27 end program