1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
! { dg-do compile }
! PR fortran/55978
!
! Passing of NULL() with and without MOLD as actual argument
!
! Testcase derived from pr55978 comment#16
program pr55978_c16
implicit none
integer, pointer :: p(:)
integer, allocatable :: a(:)
character(10), pointer :: c
character(10), pointer :: cp(:)
type t
integer, pointer :: p(:)
integer, allocatable :: a(:)
end type
type(t) :: d
! (1) pointer
p => null()
call sub (p)
! (2) allocatable
call sub (a)
call sub (d%a)
! (3) pointer component
d%p => null ()
call sub (d%p)
! (4) NULL
call sub (null (a)) ! OK
call sub (null (p)) ! OK
call sub (null (d%a)) ! OK
call sub (null (d%p)) ! OK
call sub (null ()) ! was erroneously rejected with:
! Actual argument contains too few elements for dummy argument 'x' (1/4)
call bla (null(c))
call bla (null()) ! was erroneously rejected with:
! Actual argument contains too few elements for dummy argument 'x' (1/10)
call foo (null(cp))
call foo (null())
call bar (null(cp))
call bar (null()) ! was erroneously rejected with:
! Actual argument contains too few elements for dummy argument 'x' (1/70)
contains
subroutine sub(x)
integer, intent(in), optional :: x(4)
if (present (x)) stop 1
end
subroutine bla(x)
character(len=10), intent(in), optional :: x
if (present (x)) stop 2
end
subroutine foo(x)
character(len=10), intent(in), optional :: x(:)
if (present (x)) stop 3
end
subroutine bar(x)
character(len=10), intent(in), optional :: x(7)
if (present (x)) stop 4
end
end
|