aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/allocate_with_source_16.f90
blob: 977202d04aa34243e33549bcc42483c8150db094 (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
!{ dg-do compile }
! PR69268
!
! Contributed by Rich Townsend  <townsend@astro.wisc.edu>

program test_sourced_alloc

  implicit none
 
  type :: foo_t
  end type foo_t

  class(foo_t), allocatable :: f

  allocate(f, SOURCE=f_func())

contains

  function f_func () result (f)
    type(foo_t) :: f
    integer, save :: c = 0
    c = c + 1
    if (c .gt. 1) call abort()
  end function f_func

end program test_sourced_alloc