lto: Remove random_seed from section name.
[official-gcc.git] / gcc / testsuite / gfortran.dg / ret_pointer_2.f90
blobf505549b4c3eb4068e38a6097007c30c3f1145a5
1 ! { dg-do run }
2 ! PR 25806: Functions returning pointers to arrays
3 program a
4 integer, target :: storage(5)
5 integer :: s(3)
8 print *, x(3) ! { dg-output " *1 *2 *3" }
10 if (ssum(x(3)) /= 6) STOP 1
12 s = 0
13 s = x(3)
14 if (any(s /= (/1, 2, 3/))) STOP 2
16 contains
18 function x(n) result(t)
19 integer, intent(in) :: n
20 integer, pointer :: t(:)
21 integer :: i
23 t => storage(1:n)
24 t = (/ (i, i = 1, n) /)
26 end function x
29 integer function ssum(a)
30 integer, intent(in) :: a(:)
32 ssum = sum(a)
34 end function ssum
36 end program a