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!
9module M1
10   real x
11end module M1
12
13module M2
14   contains
15      subroutine y
16      end subroutine y
17end module M2
18
19module M3
20   use M2, x => y
21end module M3
22
23module M4
24   use M1
25   use M3
26end module M4
27
28module M5
29   use M4             ! 'x' is ambiguous here but is not referred to
30end module M5
31
32module M6
33   use M5             ! ditto
34end module M6
35
36program 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!'
45end program test
46
47function x(z)
48   x = z
49end function x
50