ieee_9.f90: XFAIL on arm*-*-gnueabi[hf].
[official-gcc.git] / gcc / testsuite / gfortran.dg / allocate_alloc_opt_10.f90
blobf9d92381f952e6712f373f0cafc7c8a132949416
1 ! { dg-do run }
3 ! PR 43388: [F2008][OOP] ALLOCATE with MOLD=
5 ! Contributed by Janus Weil <janus@gcc.gnu.org>
7 type :: t1
8 integer :: i
9 end type
11 type,extends(t1) :: t2
12 integer :: j = 4
13 end type
15 class(t1),allocatable :: x,y
16 type(t2) :: z
19 !!! first example (static)
21 z%j = 5
22 allocate(x,MOLD=z)
24 select type (x)
25 type is (t2)
26 print *,x%j
27 if (x%j/=4) STOP 1
28 x%j = 5
29 class default
30 STOP 1
31 end select
34 !!! second example (dynamic, PR 44541)
36 allocate(y,MOLD=x)
38 select type (y)
39 type is (t2)
40 print *,y%j
41 if (y%j/=4) STOP 2
42 class default
43 STOP 2
44 end select
46 end