xref: /llvm-project/flang/test/Semantics/separate-mp04.f90 (revision 77e965ef454ab1fcb2564e3ade17880a71542f58)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2! Checks for multiple module procedure definitions
3
4module m1
5  interface
6    module subroutine x001
7    end subroutine
8    module subroutine x002
9    end subroutine
10    module subroutine x003
11    end subroutine
12  end interface
13end
14
15submodule(m1) sm1
16  interface
17    module subroutine x004
18    end subroutine
19  end interface
20 contains
21  module procedure x001 ! fine
22  end procedure
23  module subroutine x002
24  end subroutine
25  module subroutine x003
26  end subroutine
27end
28
29submodule(m1) sm2
30 contains
31  !ERROR: Module procedure 'x002' in 'm1' has multiple definitions
32  module subroutine x002
33  end subroutine
34end
35
36submodule(m1:sm2) sm3
37 contains
38  !ERROR: Module procedure 'x002' in 'm1' has multiple definitions
39  module subroutine x002
40  end subroutine
41  !ERROR: Module procedure 'x003' in 'm1' has multiple definitions
42  module subroutine x003
43  end subroutine
44end
45
46submodule(m1:sm1) sm4
47 contains
48  module subroutine x004
49  end subroutine
50end
51
52submodule(m1:sm1) sm5
53 contains
54  !ERROR: Module procedure 'x004' in 'm1:sm1' has multiple definitions
55  module subroutine x004
56  end subroutine
57end
58