OSDN Git Service

2005-09-18 Paul Thomas <pault@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / nested_modules_2.f90
1 ! { dg do-run }
2 ! This tests the patch for PR16861.
3 !
4 ! Contributed by Paul Thomas <pault@gcc.gnu.org>
5 !
6 module foo
7 INTEGER :: i
8 end module foo
9
10 module bar
11 contains
12 subroutine sub1 (j)
13   use foo
14   integer, dimension(i) :: j
15   j = 42
16 end subroutine sub1
17 subroutine sub2 (k)
18   use foo
19   integer, dimension(i) :: k
20   k = 84
21 end subroutine sub2
22 end module bar
23
24 module foobar
25   use foo                      !This used to cause an ICE
26   use bar
27 end module foobar
28
29 program testfoobar
30   use foobar
31   integer, dimension(3)  :: l = 0
32   i = 2
33   call sub1 (l)
34   i = 1
35   call sub2 (l)
36   if (all (l.ne.(/84,42,0/))) call abort ()
37 end program testfoobar
38