2014-07-12 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / pure_byref_2.f90
blob805653e2ed3d6099c929a1dfce41693ba92ed304
1 ! { dg-do run }
2 ! PR 22607: PURE return-by-reference functions
3 program main
4 implicit none
5 integer, dimension(2) :: b
6 b = fun(size(b))
7 if (b(1) /= 1 .or. b(2) /= 2) call abort()
8 contains
9 pure function fun(n)
10 integer, intent(in) :: n
11 integer :: fun(n)
12 integer :: i
13 do i = 1, n
14 fun(i) = i
15 end do
16 end function fun
17 end program main