aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/typebound_call_22.f03
blob: 31e5894372cf418b189841f7d9546941ac8914c5 (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
! { dg-do compile }
! { dg-options "-fdump-tree-optimized -O" }
!
! PR 50960: [OOP] vtables not marked as constant
!
! This test case checks whether the type-bound call to "x%bar"
! is optimized into a static call to "base".
!
! Contributed by Tobias Burnus <burnus@gcc.gnu.org>

module m
  type t
  contains
    procedure, nopass :: bar => base
  end type
contains
  subroutine base()
    write(*,*) 'base'
  end subroutine
end module

program test
  use m
  class(t), allocatable :: x
  allocate (t :: x)
  call x%bar ()
end program

! { dg-final { scan-tree-dump-times "base \\(\\);" 1 "optimized" } }
! { dg-final { cleanup-tree-dump "optimized" } }