Debian Codegraph @

gcc/testsuite/gfortran.dg/submodule_8.f08

raw
1 ! { dg-do run }
2 !
3 ! Checks that F2008:11.2.3 para 2 is correctly implemented so that
4 ! no error results from using 'mod_s' for both a module name and
5 ! a submodule name. The submodule is now identified as 'mod_a.mod_s'
6 ! internally and the submodule file as 'mod_a@mod_s.smod'.
7 !
8 ! Contributed by Reinhold Bader <[email protected]>
9 !
10 module mod_a
11 implicit none
12 interface
13 module subroutine p()
14 end subroutine
15 end interface
16 end module
17
18 submodule (mod_a) mod_s
19 implicit none
20 integer :: i=-2
21 contains
22 module procedure p
23 if (i .ne. -2) then
24 STOP 1
25 end if
26 end procedure
27 end submodule
28
29 module mod_s
30 use mod_a
31 implicit none
32 integer :: i=2
33 end module
34
35 program a_s
36 use mod_s
37 implicit none
38 if (i==2) then
39 call p()
40 else
41 STOP 2
42 end if
43 end program