URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 302 |
Rev 384 |
! { dg-do run }
|
! { dg-do run }
|
! Test the fix for PR43291, which was a regression that caused
|
! Test the fix for PR43291, which was a regression that caused
|
! incorrect type mismatch errors at line 46. In the course of
|
! incorrect type mismatch errors at line 46. In the course of
|
! fixing the PR, it was noted that the dynamic dispatch of the
|
! fixing the PR, it was noted that the dynamic dispatch of the
|
! final typebound call was not occurring - hence the dg-do run.
|
! final typebound call was not occurring - hence the dg-do run.
|
!
|
!
|
! Contributed by Janus Weil
|
! Contributed by Janus Weil
|
!
|
!
|
module m1
|
module m1
|
type :: t1
|
type :: t1
|
contains
|
contains
|
procedure :: sizeof
|
procedure :: sizeof
|
end type
|
end type
|
contains
|
contains
|
integer function sizeof(a)
|
integer function sizeof(a)
|
class(t1) :: a
|
class(t1) :: a
|
sizeof = 1
|
sizeof = 1
|
end function sizeof
|
end function sizeof
|
end module
|
end module
|
|
|
|
|
module m2
|
module m2
|
use m1
|
use m1
|
type, extends(t1) :: t2
|
type, extends(t1) :: t2
|
contains
|
contains
|
procedure :: sizeof => sizeof2
|
procedure :: sizeof => sizeof2
|
end type
|
end type
|
contains
|
contains
|
integer function sizeof2(a)
|
integer function sizeof2(a)
|
class(t2) :: a
|
class(t2) :: a
|
sizeof2 = 2
|
sizeof2 = 2
|
end function
|
end function
|
end module
|
end module
|
|
|
|
|
module m3
|
module m3
|
use m2
|
use m2
|
type :: t3
|
type :: t3
|
class(t1), pointer :: a
|
class(t1), pointer :: a
|
contains
|
contains
|
procedure :: sizeof => sizeof3
|
procedure :: sizeof => sizeof3
|
end type
|
end type
|
contains
|
contains
|
integer function sizeof3(a)
|
integer function sizeof3(a)
|
class(t3) :: a
|
class(t3) :: a
|
sizeof3 = a%a%sizeof()
|
sizeof3 = a%a%sizeof()
|
end function
|
end function
|
end module
|
end module
|
|
|
use m1
|
use m1
|
use m2
|
use m2
|
use m3
|
use m3
|
type(t1), target :: x
|
type(t1), target :: x
|
type(t2), target :: y
|
type(t2), target :: y
|
type(t3) :: z
|
type(t3) :: z
|
z%a => x
|
z%a => x
|
if ((z%sizeof() .ne. 1) .or. (z%a%sizeof() .ne. 1)) call abort
|
if ((z%sizeof() .ne. 1) .or. (z%a%sizeof() .ne. 1)) call abort
|
z%a => y
|
z%a => y
|
if ((z%sizeof() .ne. 2) .or. (z%a%sizeof() .ne. 2)) call abort
|
if ((z%sizeof() .ne. 2) .or. (z%a%sizeof() .ne. 2)) call abort
|
|
|
end
|
end
|
|
|
! { dg-final { cleanup-modules "m1 m2 m3" } }
|
! { dg-final { cleanup-modules "m1 m2 m3" } }
|
|
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.