1! { dg-do run }
2! PR 22607: PURE return-by-reference functions
3program 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()
8contains
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
17end program main
18