Debian Codegraph @

gcc/testsuite/gfortran.dg/interface_28.f90

raw
1 ! { dg-do compile }
2 !
3 ! PR 36947: Attributes not fully checked comparing actual vs dummy procedure
4 !
5 ! Original test case by Walter Spector <[email protected]>
6 ! Modified by Janus Weil <[email protected]>
7
8 module testsub
9 contains
10 subroutine test(sub)
11 interface
12 subroutine sub(x)
13 integer, intent(in), optional:: x
14 end subroutine
15 end interface
16 call sub()
17 end subroutine
18 end module
19
20 module sub
21 contains
22 subroutine subActual(x)
23 ! actual subroutine's argment is different in intent
24 integer, intent(inout),optional:: x
25 end subroutine
26 subroutine subActual2(x)
27 ! actual subroutine's argment is missing OPTIONAL
28 integer, intent(in):: x
29 end subroutine
30 end module
31
32 program interfaceCheck
33 use testsub
34 use sub
35
36 integer :: a
37
38 call test(subActual) ! { dg-error "INTENT mismatch in argument" }
39 call test(subActual2) ! { dg-error "OPTIONAL mismatch in argument" }
40 end program