aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/generic_19.f90
blob: 8bbbf8a0ee1b6469680c826c5e158350d5940390 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
! { dg-do compile }
! Test the fix for PR42481, in which 'sub' was not recognised as
! a generic interface.
!
! Contributed by William Mitchell < william.mitchell@nist.gov>
!
module mod1
contains
  subroutine sub(x, chr)
    real x
    character(8) chr
    if (trim (chr) .ne. "real") call abort
    if (int (x) .ne. 1) call abort
  end subroutine sub
end module mod1

module mod2
  use mod1
  interface sub
    module procedure sub, sub_int
  end interface sub
contains
  subroutine sub_int(i, chr)
    character(8) chr
    integer i
    if (trim (chr) .ne. "integer") call abort
    if (i .ne. 1) call abort
  end subroutine sub_int
end module mod2

program prog
  use mod1
  use mod2
  call sub(1, "integer ")
  call sub(1.0, "real    ")
end program prog