aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/block_11.f90
blob: 6fe244d91e8b36281686f2de5d58b06a54cb32cf (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
! { dg-do link }
!
! PR fortran/52729
!
! Based on a contribution of Andrew Benson
!
module testMod
  type testType
  end type testType
contains
  subroutine testSub()
    implicit none
    procedure(double precision ), pointer :: r
    class    (testType         ), pointer :: testObject
    double precision                      :: testVal

    ! Failed as testFunc was BT_UNKNOWN
    select type (testObject)
    class is (testType)
       testVal=testFunc()
       r => testFunc
    end select
    return
  end subroutine testSub

  double precision function testFunc()
    implicit none
    return
  end function testFunc
end module testMod

module testMod2
  implicit none
contains
  subroutine testSub()
    procedure(double precision ), pointer :: r
    double precision                      :: testVal
    ! Failed as testFunc was BT_UNKNOWN
    block
      r => testFunc
      testVal=testFunc()
    end block
  end subroutine testSub

  double precision function testFunc()
  end function testFunc
end module testMod2

module m3
  implicit none
contains
  subroutine my_test()
    procedure(sub), pointer :: ptr
    ! Before the fix, one had the link error
    ! "undefined reference to `sub.1909'"
    block
      ptr => sub
      call sub()
    end block
  end subroutine my_test
  subroutine sub(a)
    integer, optional :: a
  end subroutine sub
end module m3

end