Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | ! Copyright 2009-2020 Free Software Foundation, Inc. |
db5960b4 AB |
2 | ! |
3 | ! This program is free software; you can redistribute it and/or modify | |
4 | ! it under the terms of the GNU General Public License as published by | |
5 | ! the Free Software Foundation; either version 3 of the License, or | |
6 | ! (at your option) any later version. | |
7 | ! | |
8 | ! This program is distributed in the hope that it will be useful, | |
9 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | ! GNU General Public License for more details. | |
12 | ! | |
13 | ! You should have received a copy of the GNU General Public License | |
14 | ! along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | ||
16 | module mod3 | |
17 | integer :: mod2 = 3 | |
18 | integer :: mod1 = 3 | |
19 | integer :: var_i = 3 | |
20 | contains | |
21 | subroutine check_all | |
22 | if (mod2 .ne. 3) call abort | |
23 | if (mod1 .ne. 3) call abort | |
24 | if (var_i .ne. 3) call abort | |
25 | end subroutine check_all | |
26 | ||
27 | subroutine check_mod2 | |
28 | if (mod2 .ne. 3) call abort | |
29 | end subroutine check_mod2 | |
30 | end module mod3 | |
31 | ||
32 | module modmany | |
33 | integer :: var_a = 10, var_b = 11, var_c = 12, var_i = 14 | |
34 | contains | |
35 | subroutine check_some | |
36 | if (var_a .ne. 10) call abort | |
37 | if (var_b .ne. 11) call abort | |
38 | end subroutine check_some | |
39 | end module modmany | |
40 | ||
41 | module moduse | |
42 | integer :: var_x = 30, var_y = 31 | |
43 | contains | |
44 | subroutine check_all | |
45 | if (var_x .ne. 30) call abort | |
46 | if (var_y .ne. 31) call abort | |
47 | end subroutine check_all | |
48 | ||
49 | subroutine check_var_x | |
50 | if (var_x .ne. 30) call abort | |
51 | end subroutine check_var_x | |
52 | end module moduse | |
53 | ||
54 | subroutine sub1 | |
55 | use mod1 | |
56 | if (var_i .ne. 1) call abort | |
57 | var_i = var_i ! i-is-1 | |
58 | end subroutine sub1 | |
59 | ||
60 | subroutine sub2 | |
61 | use mod2 | |
62 | if (var_i .ne. 2) call abort | |
63 | var_i = var_i ! i-is-2 | |
64 | end subroutine sub2 | |
65 | ||
66 | subroutine sub3 | |
67 | use mod3 | |
68 | var_i = var_i ! i-is-3 | |
69 | end subroutine sub3 | |
70 | ||
71 | program module | |
72 | ||
73 | use modmany, only: var_b, var_d => var_c, var_i | |
74 | use moduse, var_z => var_y | |
75 | ||
76 | call sub1 | |
77 | call sub2 | |
78 | call sub3 | |
79 | ||
80 | if (var_b .ne. 11) call abort | |
81 | if (var_d .ne. 12) call abort | |
82 | if (var_i .ne. 14) call abort | |
83 | if (var_x .ne. 30) call abort | |
84 | if (var_z .ne. 31) call abort | |
85 | var_b = var_b ! a-b-c-d | |
86 | ||
87 | end program module |