Commit | Line | Data |
---|---|---|
44944448 | 1 | ! Copyright 2009, 2010, 2011 Free Software Foundation, Inc. |
5d7cb8df JK |
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 | ||
f55ee35c JK |
16 | module mod1 |
17 | integer :: var_i = 1 | |
c2b0a229 JK |
18 | integer :: var_const |
19 | parameter (var_const = 20) | |
f55ee35c | 20 | end module mod1 |
5d7cb8df | 21 | |
f55ee35c JK |
22 | module mod2 |
23 | integer :: var_i = 2 | |
24 | end module mod2 | |
25 | ||
26 | module modmany | |
27 | integer :: var_a = 10, var_b = 11, var_c = 12, var_i = 14 | |
28 | end module modmany | |
29 | ||
30 | subroutine sub1 | |
31 | use mod1 | |
32 | if (var_i .ne. 1) call abort | |
33 | var_i = var_i ! i-is-1 | |
34 | end | |
35 | ||
36 | subroutine sub2 | |
37 | use mod2 | |
38 | if (var_i .ne. 2) call abort | |
39 | var_i = var_i ! i-is-2 | |
40 | end | |
41 | ||
42 | program module | |
43 | ||
44 | use modmany, only: var_b, var_d => var_c, var_i | |
45 | ||
46 | call sub1 | |
47 | call sub2 | |
48 | ||
49 | if (var_b .ne. 11) call abort | |
50 | if (var_d .ne. 12) call abort | |
51 | if (var_i .ne. 14) call abort | |
52 | var_b = var_b ! a-b-c-d | |
5d7cb8df | 53 | end |