summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/associated_target_3.f90
blob: e6a1d0f0adbd4daa1cae1122c957d3b8eb294278 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
! { dg-do run }
!
! PR fortran/41777
!
module m
type t2
 integer :: i
end type t2
interface f
 module procedure f2
end interface f
contains
function f2(a)
  type(t2), pointer :: f2,a
  f2 => a
end function f2
end module m

use m
implicit none
type(t2), pointer :: a
allocate(a)
if (.not. associated(a,f(a))) call abort()
call cmpPtr(a,f2(a))
call cmpPtr(a,f(a))
deallocate(a)
contains
  subroutine cmpPtr(a,b)
    type(t2), pointer :: a,b
!    print *, associated(a,b)
    if (.not. associated (a, b)) call abort()
  end subroutine cmpPtr
end

! { dg-final { cleanup-modules "m" } }