1! { dg-do run } 2! 3! Test the fix for PR82550 in which the reference to 'p' in 'foo' 4! was not being correctly handled. 5! 6! Contributed by Reinhold Bader <Bader@lrz.de> 7! 8module m_subm_18_pos 9 implicit none 10 integer :: i = 0 11 interface 12 module subroutine foo(fun_ptr) 13 procedure(p), pointer, intent(out) :: fun_ptr 14 end subroutine 15 end interface 16contains 17 subroutine p() 18 i = 1 19 end subroutine p 20end module m_subm_18_pos 21submodule (m_subm_18_pos) subm_18_pos 22 implicit none 23contains 24 module subroutine foo(fun_ptr) 25 procedure(p), pointer, intent(out) :: fun_ptr 26 fun_ptr => p 27 end subroutine 28end submodule 29program p_18_pos 30 use m_subm_18_pos 31 implicit none 32 procedure(), pointer :: x 33 call foo(x) 34 call x() 35 if (i == 1) then 36 write(*,*) 'OK' 37 else 38 write(*,*) 'FAIL' 39 STOP 1 40 end if 41end program p_18_pos 42 43