gdb/
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.fortran / module.f90
1 ! Copyright 2009, 2010 Free Software Foundation, Inc.
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 mod1
17 integer :: var_i = 1
18 end module mod1
19
20 module mod2
21 integer :: var_i = 2
22 end module mod2
23
24 module modmany
25 integer :: var_a = 10, var_b = 11, var_c = 12, var_i = 14
26 end module modmany
27
28 subroutine sub1
29 use mod1
30 if (var_i .ne. 1) call abort
31 var_i = var_i ! i-is-1
32 end
33
34 subroutine sub2
35 use mod2
36 if (var_i .ne. 2) call abort
37 var_i = var_i ! i-is-2
38 end
39
40 program module
41
42 use modmany, only: var_b, var_d => var_c, var_i
43
44 call sub1
45 call sub2
46
47 if (var_b .ne. 11) call abort
48 if (var_d .ne. 12) call abort
49 if (var_i .ne. 14) call abort
50 var_b = var_b ! a-b-c-d
51 end
This page took 0.030062 seconds and 4 git commands to generate.