Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gfortran.dg / generic_19.f90
blobf023c5e63565acfd471a0066544b8569167b2805
1 ! { dg-do compile }
2 ! Test the fix for PR42481, in which 'sub' was not recognised as
3 ! a generic interface.
5 ! Contributed by William Mitchell < william.mitchell@nist.gov>
7 module mod1
8 contains
9 subroutine sub(x, chr)
10 real x
11 character(8) chr
12 if (trim (chr) .ne. "real") call abort
13 if (int (x) .ne. 1) call abort
14 end subroutine sub
15 end module mod1
17 module mod2
18 use mod1
19 interface sub
20 module procedure sub, sub_int
21 end interface sub
22 contains
23 subroutine sub_int(i, chr)
24 character(8) chr
25 integer i
26 if (trim (chr) .ne. "integer") call abort
27 if (i .ne. 1) call abort
28 end subroutine sub_int
29 end module mod2
31 program prog
32 use mod1
33 use mod2
34 call sub(1, "integer ")
35 call sub(1.0, "real ")
36 end program prog
37 ! { dg-final { cleanup-modules "mod1 mod2" } }