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