aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/pr69955.f90
blob: 8b7852a2ce0007352cdcbc46f20849b122c5689b (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
! { dg-do run }
! { dg-options "-fdump-tree-original" }

program p
  implicit none

  type :: t1
    integer, allocatable :: t(:)
  end type t1

  type :: t2
    type(t1), allocatable :: x1(:)
  end type t2

  type(t2) :: var(10)

  integer :: i

  do i= 1, 10
    allocate(var(i)%x1(100))
    allocate(var(i)%x1(1)%t(100))
  enddo

  open(unit = 37, file = "/dev/null", status = "old")

  call s(1)

  close(unit = 37)

  do i=1,10
    deallocate(var(i)%x1)
  enddo

contains

  subroutine s(counter)
    implicit none
    integer, intent(in) :: counter
    integer :: i, j, n

    do j=1, counter
      n = size( [ ( var(i)%x1 , i = 1, size(var) ) ] )
      write(unit = 37, fmt = '(i5)') n
    enddo
  end subroutine

end program p
! { dg-final { scan-tree-dump-times "__builtin_malloc" 4 "original" } }
! { dg-final { scan-tree-dump-times "__builtin_free" 4 "original" } }