OSDN Git Service

2008-03-13 Jerry DeLisle <jvdelisle@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / ambiguous_reference_1.f90
1 ! { dg-do compile }
2 ! Tests the fix for PR33550, in which an ICE would occur, instead of
3 ! the abiguous reference error.
4 !
5 ! Found at
6 ! http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/1abc1549a6a164f1/
7 ! by James Van Buskirk:
8 !
9 module M1
10    real x
11 end module M1
12
13 module M2
14    contains
15       subroutine y
16       end subroutine y
17 end module M2
18
19 module M3
20    use M2, x => y
21 end module M3
22
23 module M4
24    use M1
25    use M3
26 end module M4
27
28 module M5
29    use M4             ! 'x' is ambiguous here but is not referred to
30 end module M5
31
32 module M6
33    use M5             ! ditto
34 end module M6
35
36 program test
37    use M1
38    use M3
39    interface
40       function x(z)   ! { dg-error "ambiguous reference" }
41       end function x  ! { dg-error "Expecting END INTERFACE" }
42    end interface
43
44    write(*,*) 'Hello, world!'
45 end program test
46
47 function x(z)
48    x = z
49 end function x
50 ! { dg-final { cleanup-modules "m1 m2 m3 m4 m5 m6" } }