Debian Codegraph @

gcc/testsuite/gfortran.dg/intent_out_18.f90

raw
1 ! { dg-do run }
2 !
3 ! PR fortran/92178
4 ! Contributed by Mikael Morin
5
6 program p
7 implicit none
8 type t
9 integer :: i
10 integer, pointer :: pi
11 end type t
12 integer, target :: j
13 type(t), allocatable :: ta
14 j = 1
15 ta = t(2, j)
16 call assign(ta, id(ta%pi))
17 if (ta%i /= 1) stop 1
18 if (associated(ta%pi)) stop 2
19 contains
20 subroutine assign(a, b)
21 type(t), intent(out), allocatable :: a
22 integer, intent(in) , value :: b
23 allocate(a)
24 a%i = b
25 a%pi => null()
26 end subroutine assign
27 function id(a)
28 integer, pointer :: id, a
29 id => a
30 end function id
31 end program p