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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [allocate_alloc_opt_10.f90] - 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 43388: [F2008][OOP] ALLOCATE with MOLD=
4
!
5
! Contributed by Janus Weil 
6
 
7
type :: t1
8
  integer :: i
9
end type
10
 
11
type,extends(t1) :: t2
12
  integer :: j = 4
13
end type
14
 
15
class(t1),allocatable :: x,y
16
type(t2) :: z
17
 
18
 
19
!!! first example (static)
20
 
21
z%j = 5
22
allocate(x,MOLD=z)
23
 
24
select type (x)
25
type is (t2)
26
  print *,x%j
27
  if (x%j/=4) call abort
28
  x%j = 5
29
class default
30
  call abort()
31
end select
32
 
33
 
34
!!! second example (dynamic, PR 44541)
35
 
36
allocate(y,MOLD=x)
37
 
38
select type (y)
39
type is (t2)
40
  print *,y%j
41
  if (y%j/=4) 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.