Debian Codegraph @

gcc/testsuite/gfortran.dg/optional_absent_12.f90

raw
1 ! { dg-do run }
2 ! { dg-additional-options "-fcheck=array-temps" }
3 !
4 ! PR fortran/55978 - comment#19
5 !
6 ! Test passing of (missing) optional dummy to optional array argument
7
8 program test
9 implicit none
10 integer, pointer :: p(:) => null()
11 call one (p)
12 call one (null())
13 call one ()
14 call three ()
15 contains
16 subroutine one (y)
17 integer, pointer, optional, intent(in) :: y(:)
18 call two (y)
19 end subroutine one
20
21 subroutine three (z)
22 integer, allocatable, optional, intent(in) :: z(:)
23 call two (z)
24 end subroutine three
25
26 subroutine two (x)
27 integer, optional, intent(in) :: x(*)
28 if (present (x)) stop 1
29 end subroutine two
30 end