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  <reinhold.bader@lrz.de>
9!
10module mod_a
11  implicit none
12  interface
13    module subroutine p()
14    end subroutine
15  end interface
16end module
17
18submodule (mod_a) mod_s
19  implicit none
20  integer :: i=-2
21contains
22  module procedure p
23    if (i .ne. -2) then
24      call abort
25    end if
26  end procedure
27end submodule
28
29module mod_s
30  use mod_a
31  implicit none
32  integer :: i=2
33end module
34
35program 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
43end program
44! { dg-final { cleanup-submodules "mod_a@mod_s" } }
45