OSDN Git Service

gcc/fortran:
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / dummy_procedure_1.f90
1 ! { dg-do compile }
2 ! Test the patch for PR25098, where passing a variable as an
3 ! actual argument to a formal argument that is a procedure
4 ! went undiagnosed.
5 !
6 ! Based on contribution by Joost VandeVondele  <jv244@cam.ac.uk>
7 !
8 integer function y()
9   y = 1
10 end
11 integer function z()
12   z = 1
13 end
14
15 module m1
16 contains
17   subroutine s1(f)
18     interface
19       function f()
20         integer f
21       end function f
22     end interface
23   end subroutine s1
24 end module m1
25
26   use m1
27   external y
28   interface
29    function x()
30      integer x
31    end function x
32   end interface
33
34   integer :: i, y, z
35   i=1
36   call s1(i) ! { dg-error "Expected a procedure for argument" }
37   call s1(w) ! { dg-error "not allowed as an actual argument" }
38   call s1(x) ! explicit interface
39   call s1(y) ! declared external
40   call s1(z) ! { dg-error "Expected a procedure for argument" }
41 contains
42   integer function w()
43     w = 1
44   end function w
45 end
46
47 ! { dg-final { cleanup-modules "m1" } }