fix pr/45972
[official-gcc.git] / gcc / testsuite / gfortran.dg / interface_9.f90
blobb407ab0652404aaa7351dfecdcb1f8dc5dd4bd67
1 ! { dg-do compile }
2 ! Test of the patch for PR30096, in which gfortran incorrectly.
3 ! compared local with host associated interfaces.
4 !
5 ! Based on contribution by Harald Anlauf <anlauf@gmx.de>
7 module module1
8 interface inverse
9 module procedure A, B
10 end interface
11 contains
12 function A (X) result (Y)
13 real :: X, Y
14 Y = 1.0
15 end function A
16 function B (X) result (Y)
17 integer :: X, Y
18 Y = 3
19 end function B
20 end module module1
22 module module2
23 interface inverse
24 module procedure C
25 end interface
26 contains
27 function C (X) result (Y)
28 real :: X, Y
29 Y = 2.0
30 end function C
31 end module module2
33 program gfcbug48
34 use module1, only : inverse
35 call sub ()
36 if (inverse(1.0_4) /= 1.0_4) call abort ()
37 if (inverse(1_4) /= 3_4) call abort ()
38 contains
39 subroutine sub ()
40 use module2, only : inverse
41 if (inverse(1.0_4) /= 2.0_4) call abort ()
42 if (inverse(1_4) /= 3_4) call abort ()
43 end subroutine sub
44 end program gfcbug48
46 ! { dg-final { cleanup-modules "module1 module2" } }