2017-12-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / class_allocate_13.f90
blob64f37dc59b50fe35d53d047e082e0df20aa8e8d9
1 ! { dg-do run }
3 ! PR 54784: [4.7/4.8 Regression] [OOP] wrong code in polymorphic allocation with SOURCE
5 ! Contributed by Jeremy Kozdon <jkozdon@gmail.com>
7 program bug
8 implicit none
10 type :: block
11 real, allocatable :: fields
12 end type
14 type :: list
15 class(block),allocatable :: B
16 end type
18 type :: domain
19 type(list),dimension(2) :: L
20 end type
22 type(domain) :: d
23 type(block) :: b1
25 allocate(b1%fields,source=5.)
27 allocate(d%L(2)%B,source=b1) ! wrong code
29 if (d%L(2)%B%fields/=5.) call abort()
31 end program