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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [class_allocate_6.f03] - Blame information for rev 694

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do run }
2
!
3
! PR 46174: [OOP] ALLOCATE with SOURCE: Deep copy missing
4
!
5
! Contributed by Tobias Burnus 
6
 
7
implicit none
8
type t
9
end type t
10
 
11
type, extends(t) :: t2
12
  integer, allocatable :: a(:)
13
end type t2
14
 
15
class(t), allocatable :: x, y
16
integer :: i
17
 
18
allocate(t2 :: x)
19
select type(x)
20
 type is (t2)
21
   allocate(x%a(10))
22
   x%a = [ (i, i = 1,10) ]
23
   print '(*(i3))', x%a
24
 class default
25
   call abort()
26
end select
27
 
28
allocate(y, source=x)
29
 
30
select type(x)
31
 type is (t2)
32
   x%a = [ (i, i = 11,20) ]
33
   print '(*(i3))', x%a
34
 class default
35
   call abort()
36
end select
37
 
38
select type(y)
39
 type is (t2)
40
   print '(*(i3))', y%a
41
   if (any (y%a /= [ (i, i = 1,10) ])) call abort()
42
 class default
43
   call abort()
44
end select
45
 
46
end

powered by: WebSVN 2.1.0

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