Debian Codegraph @

gcc/testsuite/gfortran.dg/submodule_16.f08

raw
1 ! { dg-do compile }
2 !
3 ! Tests the fix for PR71156 in which the valid code (f7, f8 and f9 below)
4 ! triggered an error, while the invalid code (f1 to f6) compiled.
5 !
6 ! Contributed by Damian Rousn <[email protected]>
7 !
8 module my_interface
9 implicit none
10 interface
11 module subroutine f1
12 end subroutine
13 module subroutine f2
14 end subroutine
15 module subroutine f3
16 end subroutine
17 elemental module subroutine f4
18 end subroutine
19 pure module subroutine f5
20 end subroutine
21 recursive module subroutine f6
22 end subroutine
23 elemental module subroutine f7
24 end subroutine
25 pure module subroutine f8
26 end subroutine
27 recursive module subroutine f9
28 end subroutine
29 end interface
30 end module
31
32 submodule(my_interface) my_implementation
33 implicit none
34 contains
35 elemental module subroutine f1 ! { dg-error "Mismatch in ELEMENTAL attribute" }
36 end subroutine
37 pure module subroutine f2 ! { dg-error "Mismatch in PURE attribute" }
38 end subroutine
39 recursive module subroutine f3 ! { dg-error "Mismatch in RECURSIVE attribute" }
40 end subroutine
41 module subroutine f4 ! { dg-error "ELEMENTAL prefix" }
42 end subroutine
43 module subroutine f5 ! { dg-error "PURE prefix" }
44 end subroutine
45 module subroutine f6 ! { dg-error "RECURSIVE prefix" }
46 end subroutine
47 elemental module subroutine f7
48 end subroutine
49 pure module subroutine f8
50 end subroutine
51 recursive module subroutine f9
52 end subroutine
53 end submodule