OSDN Git Service

* obj-c++.dg/stubify-1.mm: Only run on powerpc.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / interface_3.f90
1 ! { dg-do compile }
2 ! Tests the fix for PR20880, which was due to failure to the failure
3 ! to detect the USE association of a nameless interface for a
4 ! procedure with the same name as the encompassing scope.
5 !
6 ! Contributed by Joost VandeVondele  <jv244@cam.ac.uk>
7 !
8 module test_mod
9 interface
10   subroutine my_sub (a)
11     real a
12   end subroutine
13 end interface
14 interface
15   function my_fun (a)
16     real a, my_fun
17   end function
18 end interface
19 end module
20
21 module test_mod2
22 interface
23   function my_fun (a)
24     real a, my_fun
25   end function
26 end interface
27 end module
28
29
30 ! This is the original PR, excepting that the error requires the symbol
31 ! to be referenced.
32 subroutine my_sub (a)
33   use test_mod
34   real a
35   call my_sub (a)  ! { dg-error "ambiguous reference" }
36   print *, a
37 end subroutine
38
39 integer function my_fun (a)
40   use test_mod
41   real a
42   print *, a
43   my_fun = 1  ! { dg-error "ambiguous reference" }
44 end function
45
46 ! This was found whilst investigating => segfault
47 subroutine thy_sub (a)
48   interface 
49     subroutine thy_sub (a) ! { dg-error "enclosing procedure" }
50       real a
51     end subroutine
52   end interface
53   real a
54   print *, a
55 end subroutine
56
57 subroutine thy_fun (a)
58   use test_mod
59   use test_mod2  ! OK because there is no reference to my_fun
60   print *, a
61 end subroutine thy_fun
62
63 subroutine his_fun (a)
64   use test_mod
65   use test_mod2
66   print *, my_fun (a)  ! { dg-error "ambiguous reference" }
67 end subroutine his_fun
68
69 ! { dg-final { cleanup-modules "test_mod test_mod2" } }