Debian Codegraph @

gcc/testsuite/gfortran.dg/c-interop/explicit-interface.f90

raw
1 ! { dg-do compile }
2 !
3 ! TS 29113
4 ! 6.2 Explicit interface
5 !
6 ! Additionally to the rules of subclause 12.4.2.2 of ISO/IEC 1539-1:2010,
7 ! a procedure shall have an explicit interface if it has a dummy argument
8 ! that is assumed-rank.
9 !
10 ! NOTE 6.1
11 ! An explicit interface is also required for a procedure if it has a
12 ! dummy argument that is assumed-type because an assumed-type dummy
13 ! argument is polymorphic.
14 !
15 ! This file contains code that is expected to produce errors.
16
17 module m1
18
19 interface
20
21 subroutine s1 (a)
22 integer :: a(..)
23 end subroutine
24
25 subroutine s2 (b)
26 type(*) :: b
27 end subroutine
28
29 end interface
30
31 end module
32
33 module m2
34
35 contains
36
37 ! This subroutine has an explicit interface, and so do the things
38 ! it calls.
39 subroutine good (a, b)
40 use m1
41 integer :: a(..)
42 type (*) :: b
43
44 call s1 (a)
45 call s2 (b)
46 end subroutine
47
48 ! This subroutine has an explicit interface, but the things it calls don't.
49 subroutine bad (a, b)
50 use m1
51 integer :: a(..)
52 type (*) :: b
53 external :: s3, s4
54
55 call s3 (a) ! { dg-error "Assumed-rank argument" }
56 call s4 (b) ! { dg-error "Assumed-type argument" }
57 end subroutine
58
59 end module
60