1! { dg-do run }
2!
3! NULL() initialization for PROCEDURE POINTERS
4!
5! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
6
7program main
8implicit none
9call test(.true.)
10call test(.false.)
11
12contains
13
14integer function hello()
15 hello = 42
16end function hello
17
18subroutine test(first)
19 logical :: first
20 integer :: i
21 procedure(integer), pointer :: x => null()
22
23 if(first) then
24  if(associated(x)) call abort()
25  x => hello
26 else
27  if(.not. associated(x)) call abort()
28  i = x()
29  if(i /= 42) call abort()
30 end if
31 end subroutine test
32
33end program main
34