aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/class_allocate_13.f90
blob: 64f37dc59b50fe35d53d047e082e0df20aa8e8d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
! { dg-do run }
!
! PR 54784: [4.7/4.8 Regression] [OOP] wrong code in polymorphic allocation with SOURCE
!
! Contributed by Jeremy Kozdon <jkozdon@gmail.com>

program bug
  implicit none

  type :: block
    real, allocatable :: fields
  end type

  type :: list
    class(block),allocatable :: B
  end type

  type :: domain
    type(list),dimension(2) :: L
  end type

  type(domain) :: d
  type(block) :: b1

  allocate(b1%fields,source=5.)
  
  allocate(d%L(2)%B,source=b1)           ! wrong code
  
  if (d%L(2)%B%fields/=5.) call abort()

end program