1! { dg-do run }
2!
3! PR fortran/41777
4!
5module m
6type t2
7 integer :: i
8end type t2
9interface f
10 module procedure f2
11end interface f
12contains
13function f2(a)
14  type(t2), pointer :: f2,a
15  f2 => a
16end function f2
17end module m
18
19use m
20implicit none
21type(t2), pointer :: a
22allocate(a)
23if (.not. associated(a,f(a))) call abort()
24call cmpPtr(a,f2(a))
25call cmpPtr(a,f(a))
26deallocate(a)
27contains
28  subroutine cmpPtr(a,b)
29    type(t2), pointer :: a,b
30!    print *, associated(a,b)
31    if (.not. associated (a, b)) call abort()
32  end subroutine cmpPtr
33end
34