2017-12-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / submodule_8.f08
blobb3c1565bbd8c260294c03644d1808f50a0f90552
1 ! { dg-do run }
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'.
8 ! Contributed by Reinhold Bader  <reinhold.bader@lrz.de>
10 module mod_a
11   implicit none
12   interface
13     module subroutine p()
14     end subroutine
15   end interface
16 end module
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       call abort
25     end if
26   end procedure
27 end submodule
29 module mod_s
30   use mod_a
31   implicit none
32   integer :: i=2
33 end module
35 program a_s
36   use mod_s
37   implicit none
38   if (i==2) then
39     call p()
40   else
41     call abort
42   end if
43 end program