PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / proc_ptr_5.f90
blobbf47d1ed3621570747f0e799b3ce67c44573a092
1 ! { dg-do run }
3 ! NULL() initialization for PROCEDURE POINTERS
5 ! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
7 program main
8 implicit none
9 call test(.true.)
10 call test(.false.)
12 contains
14 integer function hello()
15 hello = 42
16 end function hello
18 subroutine test(first)
19 logical :: first
20 integer :: i
21 procedure(integer), pointer :: x => null()
23 if(first) then
24 if(associated(x)) STOP 1
25 x => hello
26 else
27 if(.not. associated(x)) STOP 2
28 i = x()
29 if(i /= 42) STOP 3
30 end if
31 end subroutine test
33 end program main