PR target/83368
[official-gcc.git] / gcc / testsuite / gfortran.dg / proc_ptr_comp_11.f90
blob7e487fbb23e1df883bf25a356877859e5f1c9f8d
1 ! { dg-do run }
3 ! PR 40427: Procedure Pointer Components with OPTIONAL arguments
5 ! Original test case by John McFarland <john.mcfarland@swri.org>
6 ! Modified by Janus Weil <janus@gcc.gnu.org>
8 PROGRAM prog
10 ABSTRACT INTERFACE
11 SUBROUTINE sub_template(i,j,o)
12 INTEGER, INTENT(in) :: i
13 INTEGER, INTENT(in), OPTIONAL :: j, o
14 END SUBROUTINE sub_template
15 END INTERFACE
17 TYPE container
18 PROCEDURE(sub_template), POINTER, NOPASS :: s
19 END TYPE container
21 PROCEDURE(sub_template), POINTER :: f
22 TYPE (container) :: c
24 c%s => sub
25 f => sub
27 CALL f(2,o=4)
28 CALL c%s(3,o=6)
30 CONTAINS
32 SUBROUTINE sub(i,arg2,arg3)
33 INTEGER, INTENT(in) :: i
34 INTEGER, INTENT(in), OPTIONAL :: arg2, arg3
35 if (present(arg2)) call abort()
36 if (.not. present(arg3)) call abort()
37 if (2*i/=arg3) call abort()
38 END SUBROUTINE sub
40 END PROGRAM prog