OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gfortran.dg/] [dynamic_dispatch_7.f03] - Blame information for rev 399

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 302 jeremybenn
! { dg-do run }
2
! Test the fix for PR43291, which was a regression that caused
3
! incorrect type mismatch errors at line 46. In the course of
4
! fixing the PR, it was noted that the dynamic dispatch of the
5
! final typebound call was not occurring - hence the dg-do run.
6
!
7
! Contributed by Janus Weil 
8
!
9
module m1
10
  type  :: t1
11
  contains
12
    procedure :: sizeof
13
  end type
14
contains
15
  integer function sizeof(a)
16
    class(t1) :: a
17
    sizeof = 1
18
  end function sizeof
19
end module
20
 
21
 
22
module m2
23
  use m1
24
  type, extends(t1) :: t2
25
  contains
26
    procedure :: sizeof => sizeof2
27
  end type
28
contains
29
  integer function sizeof2(a)
30
    class(t2) :: a
31
    sizeof2 = 2
32
  end function
33
end module
34
 
35
 
36
module m3
37
  use m2
38
  type :: t3
39
    class(t1), pointer  :: a
40
  contains
41
    procedure :: sizeof => sizeof3
42
  end type
43
contains
44
  integer function sizeof3(a)
45
    class(t3) :: a
46
    sizeof3 = a%a%sizeof()
47
  end function
48
end module
49
 
50
  use m1
51
  use m2
52
  use m3
53
  type(t1), target :: x
54
  type(t2), target :: y
55
  type(t3) :: z
56
  z%a => x
57
  if ((z%sizeof() .ne. 1) .or. (z%a%sizeof() .ne. 1)) call abort
58
  z%a => y
59
  if ((z%sizeof() .ne. 2) .or. (z%a%sizeof() .ne. 2)) call abort
60
 
61
end
62
 
63
! { dg-final { cleanup-modules "m1 m2 m3" } }
64
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.