summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/proc_ptr_5.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/proc_ptr_5.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_5.f9033
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_5.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_5.f90
new file mode 100644
index 000000000..61cf8a35d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_5.f90
@@ -0,0 +1,33 @@
+! { dg-do run }
+!
+! NULL() initialization for PROCEDURE POINTERS
+!
+! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
+
+program main
+implicit none
+call test(.true.)
+call test(.false.)
+
+contains
+
+integer function hello()
+ hello = 42
+end function hello
+
+subroutine test(first)
+ logical :: first
+ integer :: i
+ procedure(integer), pointer :: x => null()
+
+ if(first) then
+ if(associated(x)) call abort()
+ x => hello
+ else
+ if(.not. associated(x)) call abort()
+ i = x()
+ if(i /= 42) call abort()
+ end if
+ end subroutine test
+
+end program main