OSDN Git Service

PR fortran/21177
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / pr21177.f90
1 ! { dg-do run }
2 ! PR fortran/21177
3 module mymod
4   interface tt
5     module procedure tt_i, tt_r, tt_l, tt_c4, tt_c8
6   end interface tt
7 contains
8   function tt_l(x) result(y)
9     integer :: y
10     logical, pointer :: x
11     y = 0
12   end function
13   function tt_i(x) result(y)
14     integer :: y
15     integer, pointer :: x
16     y = 1
17   end function
18   function tt_r(x) result(y)
19     integer :: y
20     real, pointer :: x
21     y = 2
22   end function
23   function tt_c4(x) result(y)
24     integer :: y
25     complex(4), pointer :: x
26     y = 3
27   end function
28   function tt_c8(x) result(y)
29     integer :: y
30     complex(8), pointer :: x
31     y = 4
32   end function
33 end module mymod
34
35 program test
36   use mymod
37   logical, pointer :: l
38   integer, pointer :: i
39   real, pointer :: r
40   complex(4), pointer :: c4
41   complex(8), pointer :: c8
42   
43   if (tt(l) /= 0) call abort()
44   if (tt(i) /= 1) call abort()
45   if (tt(r) /= 2) call abort()
46   if (tt(c4) /= 3) call abort()
47   if (tt(c8) /= 4) call abort()
48   if (tt(null(l)) /= 0) call abort()
49   if (tt(null(i)) /= 1) call abort()
50   if (tt(null(r)) /= 2) call abort()
51   if (tt(null(c4)) /= 3) call abort()
52   if (tt(null(c8)) /= 4) call abort()
53 end program test