aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/class_allocate_15.f90
blob: 46cb9c0bc01360fa4f33e0d886385c1c728102cf (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
! { dg-do run }
! { dg-options "-fdump-tree-original -fdump-tree-original -fmax-stack-var-size=1" }
!
! PR fortran/56845
!
type t
end type t
type, extends(t) :: t2
end type t2
type(t) :: y
call foo()
call bar()
contains
  subroutine foo()
    class(t), allocatable :: x
    if(allocated(x)) STOP 1
    if(.not.same_type_as(x,y)) STOP 2
    allocate (t2 :: x)
  end
  subroutine bar()
    class(t), allocatable :: x(:)
    if(allocated(x)) STOP 3
    if(.not.same_type_as(x,y)) STOP 4
    allocate (t2 :: x(4))
  end
end
! { dg-final { scan-tree-dump-times "__builtin_free" 2 "original" } }