8 integer, allocatable
:: a
9 integer, allocatable
:: b
12 if(.not
. allocated(a
)) STOP 1
19 if(allocated(a
)) STOP 4
21 if(.not
. allocated(a
)) STOP 5
24 if(.not
. allocated(a
)) STOP 7
29 call checkOptional(.false
.,.true
., 7482)
31 call checkOptional(.true
., .true
., 7482, b
)
35 integer, allocatable
, intent(out
) :: a
36 if(allocated(a
)) STOP 11
42 integer, allocatable
, intent(inout
) :: a
43 if(.not
. allocated(a
)) STOP 12
49 integer, allocatable
, intent(inout
) :: a
50 if(allocated(a
)) STOP 14
56 integer, allocatable
, intent(inout
) :: a
57 if(.not
.allocated(a
)) STOP 15
60 if(allocated(a
)) STOP 16
62 if(.not
.allocated(a
)) STOP 17
66 subroutine checkOptional(prsnt
, alloc
, val
, x
)
67 logical, intent(in
) :: prsnt
, alloc
68 integer, allocatable
, optional
:: x
69 integer, intent(in
) :: val
70 if (present(x
) .neqv
. prsnt
) STOP 18
72 if (allocated(x
) .neqv
. alloc
) STOP 19
75 if (allocated(x
)) then
79 call checkOptional2(x
)
81 if (.not
. allocated(x
)) STOP 21
82 if (x
/= -6784) STOP 22
86 end subroutine checkOptional
87 subroutine checkOptional2(x
)
88 integer, allocatable
, optional
, intent(out
) :: x
90 if (allocated(x
)) STOP 23
94 end subroutine checkOptional2