summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/pure_byref_2.f90
blob: 805653e2ed3d6099c929a1dfce41693ba92ed304 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
! { dg-do run }
! PR 22607: PURE return-by-reference functions
program main
  implicit none
  integer, dimension(2) :: b
  b = fun(size(b))
  if (b(1) /= 1 .or. b(2) /= 2) call abort()
contains
  pure function fun(n) 
    integer, intent(in) :: n
    integer :: fun(n)
    integer :: i
    do i = 1, n
        fun(i) = i
    end do
  end function fun
end program main