2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / nested_modules_2.f90
blobdeb980e39a6bd9ad0fe9addd20aff23d7976ae69
1 ! { dg-do run }
2 ! This tests the patch for PR16861.
4 ! Contributed by Paul Thomas <pault@gcc.gnu.org>
6 module foo
7 INTEGER :: i
8 end module foo
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
24 module foobar
25 use foo !This used to cause an ICE
26 use bar
27 end module foobar
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 (any (l.ne.(/84,42,0/))) call abort ()
37 end program testfoobar