1 ! Program to test the PRESENT intrinsic
2 program intrinsic_present
6 integer, dimension(10) :: c
7 integer, pointer, dimension(:) :: d
9 if (testvar()) call abort ()
10 if (.not. testvar(a)) call abort ()
11 if (testptr()) call abort ()
12 if (.not. testptr(b)) call abort ()
13 if (testarray()) call abort ()
14 if (.not. testarray(c)) call abort ()
15 if (testparray()) call abort ()
16 if (.not. testparray(d)) call abort ()
19 logical function testvar (p)
20 integer, optional :: p
24 logical function testptr (p)
25 integer, pointer, optional :: p
29 logical function testarray (p)
30 integer, dimension (10), optional :: p
31 testarray = present(p)
34 logical function testparray (p)
35 integer, pointer, dimension(:), optional :: p
36 testparray = present(p)