OSDN Git Service

2011-11-09 Janus Weil <janus@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / typebound_call_22.f03
1 ! { dg-do compile }
2 ! { dg-options "-fdump-tree-optimized -O" }
3 !
4 ! PR 50960: [OOP] vtables not marked as constant
5 !
6 ! This test case checks whether the type-bound call to "x%bar"
7 ! is optimized into a static call to "base".
8 !
9 ! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
10
11 module m
12   type t
13   contains
14     procedure, nopass :: bar => base
15   end type
16 contains
17   subroutine base()
18     write(*,*) 'base'
19   end subroutine
20 end module
21
22 program test
23   use m
24   class(t), allocatable :: x
25   allocate (t :: x)
26   call x%bar ()
27 end program
28
29 ! { dg-final { scan-tree-dump-times "base \\(\\);" 1 "optimized" } }
30 ! { dg-final { cleanup-tree-dump "optimized" } }
31
32 ! { dg-final { cleanup-modules "m" } }